Repository navigation
feat(apollo): Add a flag to stop attaching tracing headers in SentryApolloInterceptor - #6414
Merged
adinauer merged 3 commits intoOct 29, 2026
Merged
Conversation
Contributor
Author
|
I manually reviewed and verified each code in local before pushing |
Member
|
Thanks for the PR @lazerg . Will take a look and maybe shuffle some things. |
Keep the existing Kotlin default-argument constructor ABI while exposing the tracing-header opt-out through a secondary constructor. This prevents runtime linkage failures for precompiled consumers upgrading the SDK. Co-Authored-By: Claude <noreply@anthropic.com>
adinauer
marked this pull request as ready for review
October 29, 2026 10:33
adinauer
requested review from
0xadam-brown and
runningcode
and removed request for
a team
October 29, 2026 10:33
adinauer
approved these changes
Oct 29, 2026
adinauer
left a comment
Member
There was a problem hiding this comment.
LGTM, thank you for the contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
SentryApolloInterceptorhas a newattachTracingHeadersconstructor parameter. It defaults totrue, so nothing changes unless you passfalse. Withfalse, the interceptor still creates spans, but it doesn't add thesentry-traceandbaggageheaders to the request.The existing two-parameter primary constructor remains unchanged, preserving its Java and Kotlin binary API. A secondary constructor exposes
attachTracingHeaderswhile retaining Kotlin usage such asSentryApolloInterceptor(attachTracingHeaders = false).💡 Motivation and Context
In Apollo v2 the interceptor can't see the request URL, so it attaches tracing headers to every request without checking
tracePropagationTargets. Before this change there was no way to turn that off. On the issue, @adinauer picked the opt-out flag.SentryApolloInterceptorto stop attaching tracing headers for Apollo v2 #5726💚 How did you test it?
I added a test that builds the interceptor with
attachTracingHeaders = falseand checks that the request has nosentry-traceorbaggageheader. It fails without the change../gradlew :sentry-apollo:checkpasses locally.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
The docs page for the Apollo integration could mention the new flag.