sentry icon indicating copy to clipboard operation
sentry copied to clipboard

Metrics with custom units using underscores don't appear in Sentry

Open philipphofmann opened this issue 1 year ago • 0 comments

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

This problem initially appeared on the Cocoa SDK (https://github.com/getsentry/sentry-cocoa/issues/3999), but while investigating, I realized it also happens for the Python SDK, so my assumption is that it's not SDK-related.

Capture the following metrics with the Python SDK or the Cocoa SDK:

# Does NOT end up in Sentry
sentry_sdk.metrics.incr(
    key="inc_with_custom_unit_underscores",
    value=1,
    unit="custom_unit_underscores",
)

# Ends up in Sentry
sentry_sdk.metrics.incr(
    key="inc_with_custom_unit_without_underscores",
    value=1,
    unit="myCustomUnit",
)

# Does NOT end up in Sentry
sentry_sdk.metrics.set(
    key="set_with_custom_unit_underscores",
    value="3",
    unit="custom_unit_underscores",
)

# Ends up in Sentry
sentry_sdk.metrics.set(
    key="set_with_custom_unit_without_underscores",
    value="3",
    unit="myCustomUnit",
)

It's worth noting that the _ is allowed for units; see develop docs.

Expected Result

All metrics show up in Sentry.

Actual Result

Only metrics without using the _ custom unit appear in Sentry.

Product Area

Other

Link

No response

DSN

No response

Version

No response

philipphofmann avatar May 22 '24 09:05 philipphofmann