Skip to content

Conversation

@giortzisg
Copy link
Contributor

Description

This PR adds the propagateTraceparent option to the SDK, for propagating the W3C traceparent header to downstream SDKs.

Issues

@giortzisg giortzisg self-assigned this Dec 18, 2025
@linear
Copy link

linear bot commented Dec 18, 2025

if clientOptions.TracePropagationTargets != nil {
tracePropagationTargets = clientOptions.TracePropagationTargets
}
propagateTraceparent = clientOptions.PropagateTraceparent
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: propagateTraceparent read from wrong hub at construction time

The propagateTraceparent option is read from sentry.CurrentHub() at round tripper construction time and cached in the struct. However, during RoundTrip, the hub used for getting baggage and trace data comes from sentry.GetHubFromContext(request.Context()), which may be a different hub with different client options. This causes a mismatch where the traceparent propagation decision uses stale configuration instead of the configuration from the request's associated hub.

Additional Locations (2)

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This on the other hand is incorrect. The recommended way to Init sentry is using the sentry.Init func which populate the client options on the CurrentHub and that's why we read them from there on init.

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.

Add propagateTraceparent option to the httpclient integration

4 participants