Skip to content

feat: upgrade Sentry SDK to 6.1.0-alpha.1 and add trace-connected met…#252

Merged
bruno-garcia merged 4 commits intomainfrom
feat/sentry-trace-metrics
Jan 12, 2026
Merged

feat: upgrade Sentry SDK to 6.1.0-alpha.1 and add trace-connected met…#252
bruno-garcia merged 4 commits intomainfrom
feat/sentry-trace-metrics

Conversation

@bruno-garcia
Copy link
Member

…rics

Upgrades Sentry .NET SDK from 6.0.0 to 6.1.0-alpha.1 to test the new experimental trace-connected metrics API from PR getsentry/sentry-dotnet#4834.

Changes:

  • Upgrade Sentry SDK to 6.1.0-alpha.1
  • Add SentryClientMetrics decorator that emits metrics to Sentry
  • Enable experimental metrics in all apps (Server, Console, Android)
  • Use SentryClientMetrics in DI registrations

The new metrics API provides:

  • AddCounter: for counting events (files, uploads, errors)
  • RecordDistribution: for value distributions (uploaded bytes)
  • RecordGauge: for point-in-time values (jobs in flight)

Metrics are automatically correlated with the active trace/span.

🤖 Generated with Claude Code

{
o.CaptureFailedRequests = true;
o.EnableLogs = true;
o.Experimental.EnableMetrics = true;

This comment was marked as outdated.

@bruno-garcia bruno-garcia force-pushed the feat/sentry-trace-metrics branch from bf37ff6 to 6170166 Compare January 11, 2026 11:09
@github-actions
Copy link

github-actions bot commented Jan 11, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • Upgrade Sentry SDK to 6.1.0-alpha.1 and add trace-connected met… by bruno-garcia in #252

Bug Fixes 🐛

  • Clean up action version comments by BYK in #253

Build / dependencies / internal 🔧

  • (release) Switch from action-prepare-release to Craft by BYK in #251

🤖 This preview updates automatically when you update the PR.

…rics

Upgrades Sentry .NET SDK from 6.0.0 to 6.1.0-alpha.1 to test the new
experimental trace-connected metrics API from PR getsentry/sentry-dotnet#4834.

Changes:
- Upgrade Sentry SDK to 6.1.0-alpha.1
- Add SentryClientMetrics decorator that emits metrics to Sentry
- Make ClientMetrics methods virtual for proper polymorphism
- Enable experimental metrics in all apps (Server, Console, Android)
- Use SentryClientMetrics in DI registrations (Core, Server, Console)
- Fix duplicate ClientMetrics registration in Core/Startup.cs

The new metrics API provides:
- AddCounter: for counting events (files, uploads, errors)
- RecordDistribution: for value distributions (uploaded bytes)
- RecordGauge: for point-in-time values (jobs in flight)

Metrics are automatically correlated with the active trace/span.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bruno-garcia bruno-garcia force-pushed the feat/sentry-trace-metrics branch from 6170166 to 3452a2a Compare January 11, 2026 11:12
@bruno-garcia bruno-garcia marked this pull request as draft January 11, 2026 11:13
bruno-garcia and others added 2 commits January 11, 2026 12:21
Adds tests to verify that:
- SentryClientMetrics emits trace_metric items to Sentry
- All metric types (Counter, Distribution, Gauge) are emitted
- Base class counters are also incremented (dual emission)
- Polymorphism works correctly (override vs new)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- SentryClientMetrics now accepts IHub in constructor (defaults to HubAdapter.Instance)
- Tests use isolated SDK instances with recording transport
- Each test initializes/disposes its own SDK for proper isolation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bruno-garcia bruno-garcia marked this pull request as ready for review January 12, 2026 13:21
Copy link
Member

@Flash0ver Flash0ver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the Tests add some "real" value, as they essentially confirm that each overridden method of the derived SentryClientMetrics is indeed calling into the SentrySDK-Metrics-APIs ... but they are technically valid and are a foundation we can increment on later with following updates.

Other than that: ✅ ... we should see some Metrics!

@bruno-garcia
Copy link
Member Author

the tests verified the metrics class did result in Sentry's SDK capturing the metrics. So a mix of testing that the SentryClientMetrics added metrics and with what key, as well as the SDK got them into the transport. That said I was trying to verify the DI container registrations but didn't get that far.

I deleted the test file

@bruno-garcia bruno-garcia merged commit d095eac into main Jan 12, 2026
11 checks passed
@bruno-garcia bruno-garcia deleted the feat/sentry-trace-metrics branch January 12, 2026 14:38
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.

2 participants