Conversation
4d788fd to
deeab0c
Compare
deeab0c to
7e6baff
Compare
7e6baff to
51c535e
Compare
51c535e to
d7b1f55
Compare
d7b1f55 to
45876fc
Compare
45876fc to
71754bd
Compare
71754bd to
4ec37b3
Compare
4ec37b3 to
c4e83dd
Compare
c4e83dd to
c2a58ea
Compare
There was a problem hiding this comment.
The changes mostly look okay, but it seems this PR contains more changes than are suggested by the PR description. Was there perhaps a problem when rebasing the stack? Or these are all intended to be here?
Edit: Nvm, I re-read the description and suppose everything is in scope 😅
There was a problem hiding this comment.
What was this file's purpose? Was it for enable_logs == false?
| type panicStringer struct{} | ||
|
|
||
| func (panicStringer) String() string { | ||
| panic("disabled logs must not format values") | ||
| } | ||
|
|
||
| // flushFromContext flushes the client from the given context. | ||
| func flushFromContext(ctx context.Context, timeout time.Duration) { | ||
| hub := GetHubFromContext(ctx) | ||
| if hub == nil { | ||
| hub = CurrentHub() | ||
| } | ||
| hub.Flush(timeout) | ||
| ClientFromContext(ctx).Flush(timeout) | ||
| } | ||
|
|
||
| func TestDisabledLoggerDoesNotFormatValues(_ *testing.T) { | ||
| ctx := ContextWithClient(context.Background(), NewNoopClient()) | ||
| logger := NewLogger(ctx) | ||
|
|
||
| logger.Info().Emit(panicStringer{}) | ||
| logger.Info().Emitf("%v", panicStringer{}) |
| fallbackCtx := m.fallbackCtx | ||
| scope := ScopeFromContext(ctx) | ||
| if scope == nil { | ||
| scope = ScopeFromContext(fallbackCtx) | ||
| } else { | ||
| fallbackCtx = nil | ||
| } | ||
| if options.scope != nil { | ||
| scope = options.scope | ||
| } |
There was a problem hiding this comment.
l: It looks like we had similar logic in log.go. Perhaps we can extract it into a function?
| setString("sentry.release", client.options.Release) | ||
| setString("sentry.environment", client.options.Environment) | ||
| setString("sentry.server.address", serverAddress) | ||
| setString("sentry.sdk.name", sdkName) | ||
| setString("sentry.sdk.version", client.sdkVersion) | ||
| setString("user.id", scope.user.ID) | ||
| setString("user.name", scope.user.Name) | ||
| setString("user.email", scope.user.Email) |
There was a problem hiding this comment.
m: It would probably be a good idea to extract these attribute names into constants rather than hardcoding them
c2a58ea to
aeb2126
Compare
aeb2126 to
3da3e78
Compare
3da3e78 to
a5ded29
Compare
Resolve log, metric, and propagation data from context-backed clients and scopes, and expose context-based trace header helpers while retaining Hub compatibility. Use the request transaction as the scope fallback, preserve external trace precedence and sampling flags, and propagate only matching dynamic sampling context. Freeze spanless scope metadata once on first export and take trace IDs and DSC from the same locked snapshot. Reject frozen custom metadata for another trace and propagate a negative decision for fresh unsampled scope-only traces. Explicit request scopes, including metric overrides, isolate logger and meter trace fallback. Replace stale Sentry baggage while preserving outgoing third-party members. Keep malformed baggage errors visible to direct parser callers while continuing valid sentry-trace headers. Preserve head sampling metadata when a late status filter rejects a transaction.
a5ded29 to
7c1e40f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7c1e40f. Configure here.
| return span.ToBaggage() | ||
| } | ||
| return scope.propagationContextSnapshot().DynamicSamplingContext.String() | ||
| return scope.propagationContextForPropagation(hub.Client()).DynamicSamplingContext.String() |
There was a problem hiding this comment.
Hub trace headers disagree on sampling
Medium Severity
GetBaggage now applies the static zero-rate decision and writes sampled=false into DSC, but GetTraceparent and GetTraceparentW3C still read the unsampled snapshot. Callers that emit the sentry-trace header first, including the documented Hub pairing, send a deferred sampling flag while baggage already says the trace is unsampled.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7c1e40f. Configure here.


Description
This adds new trace propagation APIs that resolve with context. Also changes logs and metrics to resolve scope through context rather than the old hub API.
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:)