Conversation
Poll gauges, time gauges, long task timers, and function counters on a configurable interval while forwarding values through the existing Sentry metrics pipeline. Support disabled polling, isolate callback failures, and stop the polling worker when the registry closes. Co-Authored-By: Claude <noreply@anthropic.com>
|
📲 Install BuildsAndroid
|
# Conflicts: # sentry-micrometer/src/main/java/io/sentry/micrometer/SentryMeterRegistry.java
# Conflicts: # sentry-micrometer/src/main/java/io/sentry/micrometer/SentryMeterRegistry.java
Carry active meter removal handling forward and use the shared removal lifecycle for function counters. Co-Authored-By: Claude <noreply@anthropic.com>
| } | ||
| return new SentryMetricInfo(getConventionName(id), unit, SentryAttributes.fromMap(attributes)); | ||
| return new SentryMetricInfo( | ||
| getConventionName(id) + suffix, unit, SentryAttributes.fromMap(attributes)); |
There was a problem hiding this comment.
Not 100% sure if relevant. But, if one would configure a "SnakeCase" naming convention the suffix would be applied after the naming convention was enforce.
So, if we had request and a suffix active we would always get request.active instead of request_active as per the naming convention. Or if the id had a longer name another.request with the same suffix we would end up with another_request.active.
So, setting the naming convention registry.config().namingConvention() does not apply to the suffix.
Is that the intended way this should work?
There was a problem hiding this comment.
I'd say this is OK since the suffix we add is specific to metrics being sent to Sentry. Micrometer suggests to use . for naming which Sentry then just passes through via the identity naming convention.
Micrometer employs a naming convention that separates lowercase words with a . (dot) character.
from https://docs.micrometer.io/micrometer/reference/concepts/naming.html
PR Stack (Micrometer)
📜 Description
Closes #6148
Add fixed-rate polling for passive Micrometer meters to
SentryMeterRegistry.The registry polls gauges, time gauges, long-task timers, and function counters every 60 seconds by default. Applications can configure the interval in milliseconds or set it to zero to disable passive polling. Function counters emit positive deltas and reset their baseline when their source value decreases.
Polling resolves the active Sentry scopes at capture time, isolates callback failures between meters, skips non-finite values, and shuts down without blocking when the registry closes.
💡 Motivation and Context
Passive meters expose values through callbacks rather than record-time operations, so they cannot use the immediate forwarding added in the previous stack PR. A single registry-owned polling worker captures those values while continuing to use Sentry's existing metrics batching and transport.
FunctionTimeris intentionally deferred to the next PR because its cumulative count and total-time semantics need separate review.💚 How did you test it?
Tests cover each passive meter mapping, polling intervals, disabled polling, function-counter baselines and resets, callback isolation, dynamic scope resolution, meter removal, and shutdown.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Add separately reviewed
FunctionTimerpolling semantics in the next stack PR.#skip-changelog