fix: add missing TracesSampler fields for SamplingContext#1259
Merged
Conversation
the current SamplingContext returned on the TracesSampler was diverging from the spec and did not include ParentSampled and ParentSampleRate.
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
🤖 This preview updates automatically when you update the PR. |
sl0thentr0py
approved these changes
Apr 10, 2026
14 tasks
Merged
6 tasks
giortzisg
added a commit
to getsentry/sentry-docs
that referenced
this pull request
Apr 23, 2026
…17377) ## DESCRIBE YOUR PR Updates Go SDK docs to reflect two changes from recent sentry-go releases: **Echo v5 ([getsentry/sentry-go#1183](getsentry/sentry-go#1183 - Echo v5 changed handler signatures from `echo.Context` (interface) to `*echo.Context` (pointer) - Updated all code examples in the Echo guide to use `*echo.Context` - Updated description to mention Echo v5 requirement **TracesSampler SamplingContext fields ([getsentry/sentry-go#1259](getsentry/sentry-go#1259 - `SamplingContext` gained two new fields: `ParentSampled` and `ParentSampleRate` - `ParentSampled` works for both local and remote parent spans, replacing the old `ctx.Parent != nil` pattern - `ParentSampleRate` exposes the sample rate from the parent's Dynamic Sampling Context - Updated `default-sampling-context-platform/go.mdx` with the new struct definition - Updated `always-inherit-sampling-decision/go.mdx` to use `ctx.ParentSampled` instead of `ctx.Parent.Sampled` ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Claude <noreply@anthropic.com>
sentrivana
pushed a commit
to getsentry/sentry-docs
that referenced
this pull request
May 18, 2026
…17377) ## DESCRIBE YOUR PR Updates Go SDK docs to reflect two changes from recent sentry-go releases: **Echo v5 ([getsentry/sentry-go#1183](getsentry/sentry-go#1183 - Echo v5 changed handler signatures from `echo.Context` (interface) to `*echo.Context` (pointer) - Updated all code examples in the Echo guide to use `*echo.Context` - Updated description to mention Echo v5 requirement **TracesSampler SamplingContext fields ([getsentry/sentry-go#1259](getsentry/sentry-go#1259 - `SamplingContext` gained two new fields: `ParentSampled` and `ParentSampleRate` - `ParentSampled` works for both local and remote parent spans, replacing the old `ctx.Parent != nil` pattern - `ParentSampleRate` exposes the sample rate from the parent's Dynamic Sampling Context - Updated `default-sampling-context-platform/go.mdx` with the new struct definition - Updated `always-inherit-sampling-decision/go.mdx` to use `ctx.ParentSampled` instead of `ctx.Parent.Sampled` ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The SDK currently was returning an incomplete SamplingContext for the TracesSampler that was diverging from the spec. The returned SamplingContext did not include ParentSampled and ParentSampleRate, thus not exposing remote parent information to the users. That also lead to confusion where users would think that the exposed
SamplingContext.Parentactually tracked the remote parent as well.This fixes the behavior by adding
ParentSampledandParentSampleRatetoSamplingContext.Issues
Changelog Entry Instructions
To add a custom changelog entry, uncomment the section above. Supports:
For more details: custom changelog entries
Reminders
feat:,fix:,ref:,meta:)