Skip to content

feat!: remove SentryOptions.EnableMetrics - #5690

Merged
jamescrosswell merged 3 commits into
version7from
feat/remove-enable-metrics
Oct 7, 2026
Merged

jamescrosswell merged 3 commits into
version7from
feat/remove-enable-metrics

Conversation

@ric-oliv

@ric-oliv ric-oliv commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Closes #5675

SentryOptions.EnableMetrics has done nothing since 6.10.0. #5509 made it obsolete, with a message saying it would be removed in 7.0.0. Code that sets EnableMetrics = false still compiles, with only a warning, and the SDK sends metrics anyway. Removing the property turns that into a build error, so users find out and switch to SetBeforeSendMetric. The JavaScript SDK has removed the same option. Cocoa and Python have deprecated it and will remove it in their next major.

Breaking changes

  • SentryOptions.EnableMetrics is removed. Delete it from the options passed to SentrySdk.Init and from configuration. To drop metrics, return null from SetBeforeSendMetric.

Notes for review

  • A leftover EnableMetrics key in the Sentry configuration section is ignored by the configuration binder, so apps still start. I checked this with a test that runs a real UseSentry host, then removed the test so the suite doesn't keep testing a property that no longer exists.
  • Under Logging:Sentry, the key already stops the app at startup, as every SDK setting there has since feat(mel)!: the Microsoft.Extensions.Logging integration no longer initializes the SDK #5595. That doesn't change.
  • NLog, Serilog and log4net don't expose the option, so their configuration files aren't affected.
  • A library compiled against 6.x that sets the property throws MissingMethodException on 7.0.
  • The .NET metrics options page in sentry-docs already says the option is ignored and will be removed in 7.0.0, which is right for 6.x users. The 7.0 migration guide will cover the removal.

🤖 Generated with Claude Code

Metrics have been on regardless of this option since 6.10.0, and #5509
made it an obsolete no-op that 7.0.0 would remove. Code that set
EnableMetrics = false still compiled, with a warning, and sent metrics
anyway. It now fails to build, so users move to SetBeforeSendMetric.
The JavaScript SDK has removed the same option. Cocoa and Python have
deprecated it and will remove it in their next major.

The configuration binder ignores a leftover EnableMetrics key in the
Sentry section, so those apps still start. A test covers it through a
UseSentry host.

Refs #5675

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.18%. Comparing base (0b841f0) to head (0d1507a).
⚠️ Report is 6 commits behind head on version7.

Additional details and impacted files
@@             Coverage Diff              @@
##           version7    #5690      +/-   ##
============================================
+ Coverage     74.65%   75.18%   +0.53%     
============================================
  Files           505      520      +15     
  Lines         18372    18895     +523     
  Branches       3535     3664     +129     
============================================
+ Hits          13715    14206     +491     
- Misses         3796     3827      +31     
- Partials        861      862       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added the public API Additions/modifications to, or removals from, the public API surface area. label Oct 7, 2026
The test checked that the configuration binder ignores a key for a
property that no longer exists. It passed, which confirms that apps with
the leftover key still start. Keeping it would only test a removed
option.

Refs #5675

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ric-oliv
ric-oliv marked this pull request as ready for review October 7, 2026 14:35
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 7, 2026

@jamescrosswell jamescrosswell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@jamescrosswell
jamescrosswell merged commit 29fc6c5 into version7 Oct 7, 2026
43 checks passed
@jamescrosswell
jamescrosswell deleted the feat/remove-enable-metrics branch October 7, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

public API Additions/modifications to, or removals from, the public API surface area. risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants