Repository navigation
Conversation
5562df0 to
0e6bf84
Compare
0e6bf84 to
09cf02b
Compare
09cf02b to
388298c
Compare
388298c to
569c73b
Compare
569c73b to
580aec3
Compare
580aec3 to
75a6927
Compare
75a6927 to
bee39bc
Compare
bee39bc to
ba9db9a
Compare
645b45e to
65227ad
Compare
e3d2c9c to
cb7d5d1
Compare
cb7d5d1 to
b3a02d5
Compare
b3a02d5 to
b968fb6
Compare
b968fb6 to
c2a214f
Compare
c2a214f to
b507c5a
Compare
b507c5a to
f983a14
Compare
f983a14 to
48e970e
Compare
Look up the client, scope, and active span from context.Context instead of the hub when starting, finishing, and sampling spans, and when attaching trace data to events, logs, and metrics. Root spans continue the trace of the scope they start on, and later roots on that scope keep its first sampling decision. Forks from WithScope start a new trace unless their parent continues one. Freeze dynamic sampling context once for baggage, error capture, and transaction delivery. Explicit client bindings remain authoritative; unbound contexts follow Init. Keep incoming sampling decisions when recording is disabled, inherit local parent sampling before client overrides, and reject inconsistent continuation metadata without retaining a previous request's trace. ContinueFromHeaders and ContinueFromRequest store the continued trace on the scope, and ContinueFromTrace is removed in favor of ContinueFromHeaders. StartTransaction returns the existing root without changing its context; callers reusing a transaction must retain their caller context and leave finishing to its owner.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 78ad682. Configure here.
| scope = parent.Clone() | ||
| if !scope.continuedTrace { | ||
| scope.propagationContext = NewPropagationContext() | ||
| } |
There was a problem hiding this comment.
Forked scope keeps unrelated span
Medium Severity
WithScope replaces the cloned propagation context when continuedTrace is false, but it keeps the parent's span. A forked scope then mixes a new trace ID with the previous transaction: hub propagation still follows the old span, while spanless telemetry uses the new propagation context.
Reviewed by Cursor Bugbot for commit 78ad682. Configure here.
| entries["sample_rate"] = rate | ||
| propagation.DynamicSamplingContext.Entries = entries | ||
| } | ||
| } |
There was a problem hiding this comment.
Shared roots record wrong sample rate
Medium Severity
keepSamplingDecision returns before storing sample_rate unless the scope DSC is already frozen and populated. Later root spans on that scope inherit only the boolean decision, and sample rewrites sampleRate to 1 or 0. Their dynamic sampling context no longer matches the rate that actually sampled the trace.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 78ad682. Configure here.


Description
Modify existing tracing and propagation behavior to rely on
context.Context. Tracing now resolves state from context rather than hubs. This includes a breaking change onContinueTraceremoving the need for a hub to be passed.#skip-changelog
Issues
context.Context#1367Changelog Entry Instructions
To add a custom changelog entry, uncomment the section above. Supports:
For more details: custom changelog entries
Reminders
feat:,fix:,ref:,meta:)