feat(android): [Session based Traces for Mobile 1B] Add session trace lifecycle#5398
Draft
adinauer wants to merge 6 commits intofeat/session-based-traces-mobilefrom
Draft
feat(android): [Session based Traces for Mobile 1B] Add session trace lifecycle#5398adinauer wants to merge 6 commits intofeat/session-based-traces-mobilefrom
adinauer wants to merge 6 commits intofeat/session-based-traces-mobilefrom
Conversation
Reuse the active session propagation context for eligible mobile root transactions while preserving explicit continuations and force-new trace escapes. Add Android integration guards, configuration, and tests for the opt-in lifecycle behavior. Co-Authored-By: Claude <noreply@anthropic.com>
Treat session trace lifecycle as an option-level behavior instead of storing lifecycle state on each propagation context. This keeps the current propagation context as the ambient trace source whenever session trace lifecycle is enabled. Co-Authored-By: Claude <noreply@anthropic.com>
Reuse SpanContext copy logic when remapping root transactions onto the session propagation context. Preserve transaction identity while replacing the trace id and clearing the parent span id. Co-Authored-By: Claude <noreply@anthropic.com>
Use parent span presence as the session trace lifecycle opt-out instead of a separate TransactionContext flag. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
Co-Authored-By: Claude <noreply@anthropic.com>
8 tasks
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.
PR Stack (Session based Traces for Mobile)
📜 Description
Adds opt-in Android session trace lifecycle support and simplifies the trace model by keeping session lifecycle behavior at the option/transaction level instead of storing lifecycle state on
PropagationContext.This PR:
enableSessionTraceLifecycleconfiguration and Android wiringforceNewTracetransaction flag💡 Motivation and Context
Session-based traces on mobile need independently started root transactions to join the ambient app-session trace. Keeping this behavior behind an SDK option and deriving the opt-out from
parentSpanIdavoids per-context lifecycle state while preserving bounded/continued distributed traces.This is the new first PR in the Session based Traces for Mobile stack:
1B.💚 How did you test it?
./gradlew :sentry:compileJava :sentry:compileTestKotlin :sentry-opentelemetry:sentry-opentelemetry-core:compileJava./gradlew :sentry:test --tests 'io.sentry.ScopesTest' --tests 'io.sentry.ScopeTest' --tests 'io.sentry.util.TracingUtilsTest' :sentry-opentelemetry:sentry-opentelemetry-core:test./gradlew :sentry:test --tests 'io.sentry.ScopesTest.when session trace lifecycle is enabled, root transaction uses current propagation context' --tests 'io.sentry.ScopesTest.forceNewTrace does not override continued trace with parent span' spotlessApply apiDump./gradlew :sentry:compileJava :sentry:compileTestKotlin./gradlew :sentry:test --tests 'io.sentry.TransactionContextTest'./gradlew :sentry:compileJava :sentry:compileTestKotlin :sentry:test --tests 'io.sentry.ScopesTest.continued trace with parent span is not remapped to session trace' --tests 'io.sentry.TransactionContextTest'./gradlew spotlessApply apiDump📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Continue the Session based Traces for Mobile stack.