Nav3 SentryTraced spans attach to another root’s navigation transaction
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Read sentry-compose/.../SentryComposeTracing.kt and the Nav3 entry span and lease handling added for #6345; the payload does not name those implementation files. Trace how LocalSentrySpan.current.orBootstrapCurrentTransaction() selects a parent when multiple roots compose, then reproduce with the sample’s multi-Activity or ViewPager2 steps. Done means each route’s composition and render spans attach only to its own navigation transaction, or remain unattached when that root has no transaction; the API and preview-span policy still need design review.
由索引模型根據 Issue 內容生成。
描述
Description
When multiple Nav3 roots are hosted by different Activities or Fragments, SentryTraced can attach a route's ui.compose and ui.render spans to another root's navigation transaction. This produces a trace whose transaction name and child route names disagree.
Reproduced with the Android sample app on fix/nav3-view-pager-2 (sample build from c1113ebedb; a later amend changed only tests), version 8.61.1, on an API 37 emulator. The sample's Recent transactions sheet reads the finished SentryTransaction from beforeSendTransaction, so the mismatch is in the transaction sent by the SDK.
Steps to reproduce
Multi-Activity
- In the Android sample, open Nav3 Activity with the default setup, then select Multi-Activity.
- Open Products Activity → Open Product 42.
- Tap Push Confirmation in 5 s, then immediately tap Go to Checkout to open Checkout Activity.
- After the delayed route is pushed in the background Products Activity, leave Checkout and inspect Recent transactions.
The tagged controls are nav3_tab_multi_activity, nav3_multi_activity_open_products, nav3_product_list_open_product_42, nav3_product_detail_delayed_confirmation, and nav3_product_detail_go_to_checkout.
Multi-Fragment / ViewPager2
- In the same sample, select Multi-Fragment → Open fragments Activity → Pager.
- Move from Page 0 to Page 1 and Page 2. The neighboring Fragment pages are preloaded at
STARTED(offscreenPageLimit = 1). - Inspect the finished Page 0
/ProductListtransaction in Recent transactions.
The tagged controls are nav3_tab_multi_fragment, nav3_multi_fragment_open_fragments, nav3_multi_fragment_open_pager, and nav3_multi_fragment_page_0 through _2.
Expected
A SentryTraced route's composition and render spans are children of that route's own navigation transaction. If its root does not currently have a transaction, its spans should not be attached to another root's transaction.
Actual
- The Checkout Activity's
/Checkouttransaction containsui.compose - Nav3 /Confirmationfrom the background Products Activity. Captured trace. - A Page 0
/ProductListtransaction containsui.composeandui.renderspans for Page 1/Checkoutand Page 2/Confirmation. Captured trace.
The sample's test.navigation.route_activation spans also attach to the wrong transaction in these runs. Those spans come from sample instrumentation; the ui.compose and ui.render spans demonstrate the SDK issue.
Likely cause
SentryTraced obtains its owner from LocalSentrySpan.current.orBootstrapCurrentTransaction() (sentry-compose/.../SentryComposeTracing.kt). The Nav3 sample does not provide a per-entry LocalSentrySpan, so the fallback reads whichever transaction is bound to the shared scope at composition time. A background Activity or preloaded Fragment can compose while another root owns that scope transaction. The Nav3 lease limits which root publishes navigation state but does not bind SentryTraced spans to their entry.
A possible fix is for each Nav3 entry to provide its own parent span to SentryTraced, with a no-op owner when the entry has no transaction. The exact API and preview-span policy need design review.
Related
- #6345 added multi-Activity and multi-Fragment Nav3 support. This issue concerns composition-span attribution across those roots.
- #6366 tracks idle
SentryTracedtransactions finishing at the deadline; that timeout behavior is separate from this attribution bug.
- 主要語言
- Kotlin
- 星號
- 1.4k
- 分支
- 483
- 平均合併
- 2 天 54 分鐘
- 30 天內合併 PR
- 207
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
getsentry/sentry-java 的其他 Issue
-
Test the `sentry wizard` Android port可能已有人在做 @antonis 於 1 天前認領。 未關閉Platform: Java
getsentry/sentry-java#6797 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Narrow and clean up Android consumer keep rules可能已有人在做 @runningcode 於 3 天前認領。 未關閉Android Platform: Java
getsentry/sentry-java#6771 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Android Bug Platform: Java Waiting for: Product Owner
難度 4/5 3-5 天 新手友好度 45/100
getsentry/sentry-java#6758 · 4 則留言 ·
維護者通常 1 天內回覆
-
Android Bug Platform: Java Replays
難度 3/5 1-2 天 新手友好度 62/100
getsentry/sentry-java#6741 · 1 則留言 ·
維護者通常 1 天內回覆
-
Android Bug Platform: Java Replays
難度 3/5 1-2 天 新手友好度 50/100
getsentry/sentry-java#6740 · 1 則留言 ·
維護者通常 1 天內回覆
查看 getsentry/sentry-java 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 62/100
IacobIonut01/ReFra#1515 · 1 則留言 ·
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
openwatersio/slackwater-android#162 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 半天 新手友好度 72/100
developmentwithyash/yaan#184 ·
維護者通常 1 天內回覆
-
analytics
難度 2/5 1-3 小時 新手友好度 62/100
-
🐛 Type:Bug 📏 Size: S 🔧 State:In Progress 🔹 Priority: P2 - Medium
難度 2/5 1-3 小時 新手友好度 70/100
yeliqin666/xjtu-toolbox-android#623 · 1 則留言 ·