getsentry/sentry-cocoa

Certain Metrics don't show up in Sentry

Closed this issue · 2 comments

Platform

iOS, iPadOS, tvOS, macOS, watchOS, visionOS

Environment

Develop

Installed

Manually

Version

8.26.0

Xcode Version

15.4

Did it work on previous versions?

No.

Steps to Reproduce

Capture the following metrics.

SentrySDK.metrics.set(key: "app_hangs_perseus_client_id_2", value: "3", unit: MeasurementUnit(unit: "perseus_session_id"))
SentrySDK.metrics.increment(key: "app_hangs_perseus_client_id_3", unit: MeasurementUnit(unit: "perseus_session_id"))

Expected Result

The metrics should show up in Sentry.

Actual Result

The metrics above don't show up in Sentry. Removing the custom unit solves the problem, and using a unit called custom also solves the problem.

Are you willing to submit a PR?

No response

┆Issue is synchronized with this Jira Improvement by Unito

My guess is that there is a problem with the sanitizing

private func sanitize(metricUnit: String) -> String {
// We can't use \w because it includes chars like ä on Swift
return metricUnit.replacingOccurrences(of: "[^a-zA-Z0-9_]", with: "", options: .regularExpression)
}

This also happens with the Python SDK, so I think this isn't SDK-related, but a problem with the metrics pipeline or something. I opened another issue: getsentry/sentry#71323.