Skip to content

fix: add missing TracesSampler fields for SamplingContext#1259

Merged
giortzisg merged 1 commit into
masterfrom
fix/traces-sampler
Apr 13, 2026
Merged

fix: add missing TracesSampler fields for SamplingContext#1259
giortzisg merged 1 commit into
masterfrom
fix/traces-sampler

Conversation

@giortzisg

@giortzisg giortzisg commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

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.Parent actually tracked the remote parent as well.

This fixes the behavior by adding ParentSampled and ParentSampleRate to SamplingContext.

Issues

Changelog Entry Instructions

To add a custom changelog entry, uncomment the section above. Supports:

  • Single entry: just write text
  • Multiple entries: use bullet points
  • Nested bullets: indent 4+ spaces

For more details: custom changelog entries

Reminders

the current SamplingContext returned on the TracesSampler was diverging
from the spec and did not include ParentSampled and ParentSampleRate.
@giortzisg giortzisg requested a review from cleptric April 10, 2026 08:08
@giortzisg giortzisg self-assigned this Apr 10, 2026
@github-actions

github-actions Bot commented Apr 10, 2026

Copy link
Copy Markdown

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

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


Bug Fixes 🐛

  • Add missing TracesSampler fields for SamplingContext by giortzisg in #1259

🤖 This preview updates automatically when you update the PR.

@giortzisg giortzisg merged commit 284b2f6 into master Apr 13, 2026
21 checks passed
@giortzisg giortzisg deleted the fix/traces-sampler branch April 13, 2026 08:11
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>
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.

Missing Parent in SamplingContext when using TracesSampler with Gin

2 participants