René's URL Explorer Experiment


Title: Nav3: Decide whether returning to a Nav3 root should start a new nav transaction · Issue #6454 · getsentry/sentry-java · GitHub

Open Graph Title: Nav3: Decide whether returning to a Nav3 root should start a new nav transaction · Issue #6454 · getsentry/sentry-java

X Title: Nav3: Decide whether returning to a Nav3 root should start a new nav transaction · Issue #6454 · getsentry/sentry-java

Description: Background A "Nav3 root" is an Activity or Fragment (including a ViewPager2 page) that owns a nav back stack and calls SentryNavEffect. Today a new nav transaction is started under a Nav3 root in two cases: the root's nav back stack is i...

Open Graph Description: Background A "Nav3 root" is an Activity or Fragment (including a ViewPager2 page) that owns a nav back stack and calls SentryNavEffect. Today a new nav transaction is started under a Nav3 root in t...

X Description: Background A "Nav3 root" is an Activity or Fragment (including a ViewPager2 page) that owns a nav back stack and calls SentryNavEffect. Today a new nav transaction is started under a Nav3...

Opengraph URL: https://github.com/getsentry/sentry-java/issues/6454

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Nav3: Decide whether returning to a Nav3 root should start a new nav transaction","articleBody":"### Background\n\nA **\"Nav3 root\"** is an Activity or Fragment (including a ViewPager2 page) that owns a nav back stack and calls `SentryNavEffect`. Today a new nav transaction is started under a Nav3 root in two cases:\n\n- the root's nav back stack is initialized (i.e., the root was just created, it initialized the nav back stack and passed it to SentryNavEffect), or\n- the root's nav back stack changed.\n\nWhen the user comes back to a root whose nav transaction has already finished, ***no new nav transaction is started***. This can happen when the user:\n\n1. swipes back to a ViewPager2 page the user already visited,\n2. goes back to an earlier Activity with its own `SentryNavEffect`, or\n3. dismisses an overlay Fragment or dialog that has its own `SentryNavEffect`.\n\n...but it only happens if the earlier Activity or Fragment retains the same, already-initialized (and unchanged**) nav back stack. E.g., if the Activity or Fragment happens to be destroyed and recreated before the user goes back or dismisses the overlay, then a new transaction will be created due to nav back stack initialization. Whether that happens depends on OS memory and component management policies rather than anything the user does, and so Sentry's behavior can appear random.  \n\nHappily, errors continue to be attributed correctly regardless, as breadcrumbs, the screen name, and the nav context still update on every return. But what can be lost are the spans for work performed after the return, such as a data refresh when the screen resumes.\n\nThe current approach matches what we do for Nav2 and the Activity integration. Neither starts a nav transaction when the user returns to an existing root. This issue asks whether we should change that approach for Nav3?\n\n** If the user starts navigating around the nav subgraph owned by the Nav3 root, then nav transactions will be started again and spans will be captured. The issue discussed here is limited to what happens when the user transitions between Nav3 roots *without* a corresponding change to the incoming root's nav back stack.\n\n### To decide\n\n**1. What does a nav transaction mean?**\n- **\"The nav back stack changed\"**: The current behavior, which matches what we do for Nav2. Returning to a Nav3 root isn't itself a navigation event unless the root initializes or updates its nav back stack. (In particular, any unfinished nav transaction started by the root being returned to will be reinstated; but if the transaction finished in the meantime, no new nav transaction is started.)\n- **\"The nav back stack changed OR the user returned to a Nav3 root\"**: An alternative approach. Returning to a Nav3 root is deemed to be a navigation event and always generates a new nav transaction.\n\n**2. Should the new behavior be on or off by default?**\n\nThe proposed rule: when a root gains the nav lease and has no running transaction, start one.\n\n| | Opt-in (`SentryNavOptions` flag, default off) | On by default |\n|---|---|---|\n| Existing users | No change | Behavior changes for setups that already ship multi-root support |\n| Nav transaction counts on dashboards | Unchanged | Go up and mean something different |\n| Matches Nav2 and the Activity integration | Yes, by default | No |\n| Competes with user-interaction transactions for the scope | Only when enabled | Always |\n| ViewPager2 behavior by default | Still depends on Fragment retention | Predictable |\n\nNew features in this SDK are opt-in by default, which favours a flag. The default could be flipped later based on feedback.\n\n**3. Should return transactions be marked?**\n\nFor example, add a `navigation.trigger` attribute with `\"return\"` on these transactions. Users could then filter or exclude them while still charting them with other nav transactions (same op and name).\n\nNo `navigation.trigger` attribute exists today, so this means either:\n- adding it to all nav transactions (e.g., `push`, `pop`, `return`), or\n- setting it only on return transactions.\n\n### Alternative considered\n\n**Start a transaction on return only for ViewPager2** (when the lease moves between roots in the same Activity). Rejected for now:\n- It needs each root to track its host Activity, which isn't implemented yet.\n- \"Return\" would mean different things in different setups, which is harder to explain and document.\n\n### Constraints\n\n- **Land after #6396.** Until then, idle nav transactions can hold the scope for up to 30 s. Return transactions would then block other transactions, and page changes in that window would lose theirs.\n- **Expect empty transactions.** A root's startup work usually happened long before the return, so many return transactions will have no spans. Empty idle transactions are dropped and don't use quota, but they only help screens that do work when they resume.\n\n### Implementation sketch\n\n_Clanker-generated 🤖_\n\nOpt-in and on-by-default cost about the same to build. Either way, the follow-up needs more than #6398's staging: `StagedNavTransaction` forgets a transaction once it finishes, so on a return there's no request left to stage again.\n\n**Needed regardless of approach**\n- **A trigger:** detect that a root gained the nav lease and has no running transaction (`NavLeaseCoordinator` / `NavScopes`).\n- **A new request:** a transaction context, options, `arguments`, view names and the back stack for the root's current top. Today `BackStackObserver` builds these only when the back stack changes.\n- **A start:** through `StagedNavTransaction`, which already discards a start that's blocked by another bound transaction.\n- **Supporting changes:** rotate the propagation context, add the `SentryNavOptions` flag (public API), add the optional `navigation.trigger` marker, and add tests and docs.\n\n**Approach 1: Replay through `BackStackObserver`**\n\nOn lease gain without a running transaction, the lifecycle package tells the root's observer, which starts a transaction for its current top without emitting a breadcrumb or changing the screen.\n- Pros: builds the request the same way as normal navigation, with current data (including a fresh app context). The marker fits naturally here.\n- Cons: needs a callback from the lifecycle package back to the observer. The observer has to keep its last back stack data, and the change touches both layers.\n\n**Approach 2: Remember the last request in `StagedNavTransaction`**\n\nKeep the last context, options and recorded data (arguments, app, Navigation context) after the transaction finishes. On lease gain without a running transaction, stage a copy and publish it.\n- Pros: stays inside the lifecycle package, which is in line with its encapsulation policy, and the change is small.\n- Cons: replays data captured at the original navigation, so the app context could be minutes old. Each copy needs a fresh `TransactionContext` (new trace and sampling decision), and the transaction handle has to be able to copy itself.\n\n**Approach 3: A coordinator hook, with the observer building the request**\n\nA variant of approach 1: `NavLeaseCoordinator` gains a \"lease gained, no running transaction\" event on `LeasedNavState`. `NavScopes` forwards it to a callback that `SentryNavEffect` wires to the observer.\n- Pros: the decision about when to start stays in the coordinator, and building the request stays in the observer. The responsibilities are the clearest of the three.\n- Cons: the most new plumbing.\n\nApproach 1 or 3 is preferred, since both build the request from current data.\n\n\n","author":{"url":"https://github.com/0xadam-brown","@type":"Person","name":"0xadam-brown"},"datePublished":"2026-11-03T10:32:57Z","url":"https://github.com/getsentry/sentry-java/issues/6454"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ef39e089-8ad4-718d-848c-b4ab5e5402cb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE4DA:3C835:479E51:64B9EA:6B0470B7
html-safe-nonce8ed64c80508ac26c4bf6652285fdf178256909b9d31cd758c5b5be6dcbc0d348
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNERBOjNDODM1OjQ3OUU1MTo2NEI5RUE6NkIwNDcwQjciLCJ2aXNpdG9yX2lkIjoiNTMwNTkyNTAzODExNTY1MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb0f26f33667a6eab2d642b62c3125c44d3dd04730f201e0c5c5e29469aaad752
hovercard-subject-tagissue:6180787120
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/6454/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5ee3041909befaddf8911a6428ed539f1e45f36d504464c1e6754c52e509d170/getsentry/sentry-java/issues/6454
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5ee3041909befaddf8911a6428ed539f1e45f36d504464c1e6754c52e509d170/getsentry/sentry-java/issues/6454
og:image:altBackground A "Nav3 root" is an Activity or Fragment (including a ViewPager2 page) that owns a nav back stack and calls SentryNavEffect. Today a new nav transaction is started under a Nav3 root in t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:username0xadam-brown
hostnamegithub.com
expected-hostnamegithub.com
Noneae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3368190
octolytics-dimension-repository_nwogetsentry/sentry-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3368190
octolytics-dimension-repository_network_root_nwogetsentry/sentry-java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecfb5f24c6e01d85f70804652a5107e5cac03a161
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-java/issues/6454#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-java%2Fissues%2F6454
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-java%2Fissues%2F6454
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-java
Reloadhttps://github.com/getsentry/sentry-java/issues/6454
Reloadhttps://github.com/getsentry/sentry-java/issues/6454
Reloadhttps://github.com/getsentry/sentry-java/issues/6454
getsentryhttps://github.com/getsentry
sentry-javahttps://github.com/getsentry/sentry-java
Codehttps://github.com/getsentry/sentry-java
Issues266 (266)https://github.com/getsentry/sentry-java/issues
Pull requests57 (57)https://github.com/getsentry/sentry-java/pulls
Discussionshttps://github.com/getsentry/sentry-java/discussions
Actionshttps://github.com/getsentry/sentry-java/actions
Projectshttps://github.com/getsentry/sentry-java/projects
Security and quality2 (2)https://github.com/getsentry/sentry-java/security
Insightshttps://github.com/getsentry/sentry-java/insights
https://github.com/getsentry/sentry-java
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-java/issues/6454
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-java/issues/6454
Nav3: Decide whether returning to a Nav3 root should start a new nav transactionhttps://github.com/getsentry/sentry-java/issues/6454#top
https://github.com/0xadam-brown
AndroidSDKhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
ImprovementIssue typehttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Improvement%22
Platform: Javahttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Platform%3A%20Java%22
Spanshttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Spans%22
https://github.com/0xadam-brown
0xadam-brownhttps://github.com/0xadam-brown
on Nov 3, 2026https://github.com/getsentry/sentry-java/issues/6454#issue-6180787120
fix(tracing): Stop idle spans from keeping idle transactions alive until their deadline (JAVA-795) #6396https://github.com/getsentry/sentry-java/pull/6396
#6398https://github.com/getsentry/sentry-java/pull/6398
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Nov 3, 2026https://github.com/getsentry/sentry-java/issues/6454#issuecomment-6601266308
Linear Codehttps://linear.app
JAVA-823https://linear.app/getsentry/issue/JAVA-823
github-actionshttps://github.com/apps/github-actions
Platform: Javahttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Platform%3A%20Java%22
on Nov 3, 2026https://github.com/getsentry/sentry-java/issues/6454#event-35007712395
linear-codehttps://github.com/apps/linear-code
ImprovementIssue typehttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Improvement%22
Spanshttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Spans%22
on Nov 3, 2026https://github.com/getsentry/sentry-java/issues/6454#event-35007739195
0xadam-brownhttps://github.com/0xadam-brown
AndroidSDKhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
on Nov 3, 2026https://github.com/getsentry/sentry-java/issues/6454#event-35010654203
0xadam-brownhttps://github.com/0xadam-brown
on Nov 3, 2026https://github.com/getsentry/sentry-java/issues/6454#event-35010670605
0xadam-brownhttps://github.com/0xadam-brown
on Nov 3, 2026https://github.com/getsentry/sentry-java/issues/6454#event-35010682562
0xadam-brownhttps://github.com/0xadam-brown
on Nov 4, 2026https://github.com/getsentry/sentry-java/issues/6454#event-35145698667
feat(android): Start a new Nav3 transaction when returning to a nav r…https://github.com/getsentry/sentry-java/commit/d44911984c32d961d00b08b2290a10cbdcbb9bb3
d449119https://github.com/getsentry/sentry-java/commit/d44911984c32d961d00b08b2290a10cbdcbb9bb3
0xadam-brownhttps://github.com/0xadam-brown
on Nov 6, 2026https://github.com/getsentry/sentry-java/issues/6454#event-35338472575
0xadam-brownhttps://github.com/0xadam-brown
completedhttps://github.com/getsentry/sentry-java/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 13, 2026https://github.com/getsentry/sentry-java/issues/6454#event-36018867821
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-java/issues/6454
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-java/issues/6454
0xadam-brownhttps://github.com/0xadam-brown
AndroidSDKhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
ImprovementIssue typehttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Improvement%22
Platform: Javahttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Platform%3A%20Java%22
Spanshttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Spans%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.