feat: Add W3C traceparent support to tracing client and utils #2843
+55
−0
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
Based on the changes in getsentry/sentry-php@a31d418, passes the Sentry traceId and spanId as a W3C traceparent header in HTTP requests to allow trace propagation using W3C standards.
💡 Motivation and Context
This adds support for propagating the Sentry TraceId as a W3C TraceSpan header to support #1831.
This is probably the easiest way to implement W3C
traceparent
headers without introducing breaking changes. There might be a performance implication as the header value is recomputed every time. As an alternative, I considered adding a computed value toSentryTraceHeader
(akin toSentryTraceHeader.value
), but that would violate that class' responsibility. Another alternative might be adding aISentrySpan.toW3CTrace()
method, but introducing this as a breaking change feels kinda clunky.💚 How did you test it?
I currently don't have a full test setup for dart, so I tested with integration tests only for now.
📝 Checklist
sendDefaultPii
is enabled🔮 Next steps
If anyone had a Sentry integrated dart client that called a server that supports the W3C traceparent header, it would be great if they could test this PR.