Skip to content

Conversation

@alexander-alderman-webb
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Nov 3, 2025

Description

Add a toggle for metrics in the form of an enable_metrics flag that defaults to True.

The PR is not undoing #5046 because

Issues

Reminders

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.93%. Comparing base (8965821) to head (58a65d2).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/utils.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5056      +/-   ##
==========================================
- Coverage   83.96%   83.93%   -0.03%     
==========================================
  Files         179      179              
  Lines       17894    17900       +6     
  Branches     3177     3179       +2     
==========================================
  Hits        15024    15024              
- Misses       1900     1907       +7     
+ Partials      970      969       -1     
Files with missing lines Coverage Δ
sentry_sdk/client.py 84.09% <100.00%> (+0.44%) ⬆️
sentry_sdk/consts.py 99.40% <ø> (ø)
sentry_sdk/utils.py 86.25% <50.00%> (-0.17%) ⬇️

... and 3 files with indirect coverage changes

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review November 3, 2025 10:47
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner November 3, 2025 10:47
return False

return bool(options.get("enable_metrics", True))

Copy link

Choose a reason for hiding this comment

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

Bug: Metrics toggle ignores experimental flag, breaking compatibility

The has_metrics_enabled function only checks the top-level enable_metrics option, ignoring the experimental _experiments.enable_metrics option. This breaks backward compatibility for users disabling metrics through the experimental flag.

Fix in Cursor Fix in Web

Copy link
Contributor Author

@alexander-alderman-webb alexander-alderman-webb Nov 4, 2025

Choose a reason for hiding this comment

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

Yes, but I couldn't think of a good way to combine them because the experimental option defaulted to False and the stable option defaults to True.

@alexander-alderman-webb alexander-alderman-webb merged commit 6a76cc5 into master Nov 5, 2025
129 of 130 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/enable_metrics_option branch November 5, 2025 07:50
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.

3 participants