Skip to content

Conversation

@xjshi
Copy link

@xjshi xjshi commented Jan 6, 2026

In SentryTraceContext, the 'sampled' key was incorrectly using _sampleRate.

📜 Description

In SentryTraceContext.m, the 'sampled' key was incorrectly using _sampleRate. This resulted in malformed trace contexts being sent to Sentry, potentially breaking sampling decisions in distributed tracing.

In SentryTraceContext, the 'sampled' key was incorrectly using _sampleRate.
@itaybre
Copy link
Contributor

itaybre commented Jan 7, 2026

@xjshi thanks for the fix!

Would you mind adding a test for this? Or would like me to push the required tests for this? (to this doesn't happen again)

@itaybre itaybre added the ready-to-merge Use this label to trigger all PR workflows label Jan 7, 2026
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.738%. Comparing base (23936a7) to head (0c53284).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #7120       +/-   ##
=============================================
+ Coverage   84.691%   84.738%   +0.047%     
=============================================
  Files          459       459               
  Lines        27494     27494               
  Branches     12121     12126        +5     
=============================================
+ Hits         23285     23298       +13     
+ Misses        4169      3937      -232     
- Partials        40       259      +219     
Files with missing lines Coverage Δ
Sources/Sentry/SentryTraceContext.m 96.078% <100.000%> (ø)

... and 32 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23936a7...0c53284. Read the comment docs.

@xjshi
Copy link
Author

xjshi commented Jan 8, 2026

@itaybre Test added. It verifies all fields in the dictionary returned by the serialize method to ensure correct mapping.

@philprime
Copy link
Member

@sentry review

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

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants