Skip to content

feat(micrometer): [Micrometer 2] Add passive meter polling - #6114

Draft
adinauer wants to merge 1 commit into
feat/micrometer-active-metersfrom
feat/micrometer-passive-polling
Draft

adinauer wants to merge 1 commit into
feat/micrometer-active-metersfrom
feat/micrometer-passive-polling

Conversation

@adinauer

@adinauer adinauer commented Sep 15, 2026

Copy link
Copy Markdown
Member

PR Stack (Micrometer)


📜 Description

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.

FunctionTimer is intentionally deferred to the next PR because its cumulative count and total-time semantics need separate review.

💚 How did you test it?

./gradlew spotlessApply apiDump
./gradlew :sentry-micrometer:check

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

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

Add separately reviewed FunctionTimer polling semantics in the next stack PR.

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

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>
@github-actions

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 170c0a5

@sentry

sentry Bot commented Sep 15, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.56.0 (1) release

⚙️ sentry-android Build Distribution Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant