You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements Sentry integration for Android Navigation 3 library.
This new module provides automatic breadcrumb capture and performance
tracing for navigation events in Compose applications using Navigation 3's
back stack-based architecture.
Key features:
- Observes back stack state changes using Compose snapshotFlow
- Captures breadcrumbs with from/to routes and back stack state
- Creates idle transactions for navigation events
- Each composable maintains independent transaction state for proper
multi-pane/split-screen support
- Supports custom keyToRoute extraction for any back stack key type
- Multiplatform-friendly (Android + Desktop JVM targets)
- Respects global SentryOptions for tracing and screen tracking
Usage:
```kotlin
val backStack = rememberNavBackStack<NavKey>(HomeScreen)
// In your composable
SentryNavigation3Traced(
backStack = backStack.toList()
)
// Or with custom configuration
SentryNavigation3Traced(
backStack = backStack.toList(),
enableNavigationBreadcrumbs = true,
enableNavigationTracing = true,
keyToRoute = { it.route }
)
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: sentry-android-navigation3/api/android/sentry-android-navigation3.api
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,6 @@ public final class io/sentry/android/navigation3/BuildConfig {
7
7
}
8
8
9
9
public final class io/sentry/android/navigation3/SentryNavigation3IntegrationKt {
10
-
public static final fun withSentryObservableEffect (Landroidx/compose/runtime/snapshots/SnapshotStateList;ZZLkotlin/jvm/functions/Function1;Lio/sentry/IScopes;Landroidx/compose/runtime/Composer;II)Landroidx/compose/runtime/snapshots/SnapshotStateList;
11
-
public static final fun withSentryObservableEffect (Landroidx/compose/runtime/snapshots/SnapshotStateList;ZZLkotlin/jvm/functions/Function1;Lio/sentry/IScopes;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V
10
+
public static final fun SentryNavigation3Traced (Ljava/util/List;ZZLkotlin/jvm/functions/Function1;Lio/sentry/IScopes;Landroidx/compose/runtime/Composer;II)V
Copy file name to clipboardExpand all lines: sentry-android-navigation3/src/androidMain/kotlin/io/sentry/android/navigation3/SentryNavigation3Integration.kt
Copy file name to clipboardExpand all lines: sentry-android-navigation3/src/androidUnitTest/kotlin/io/sentry/android/navigation3/SentryNavigation3IntegrationTest.kt
-14Lines changed: 0 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,6 @@ class SentryNavigation3IntegrationTest {
54
54
fun`adds breadcrumb on navigation`() {
55
55
val observer =
56
56
SentryBackStackObserver(
57
-
backStack = backStack,
58
57
enableNavigationBreadcrumbs =true,
59
58
enableNavigationTracing =false,
60
59
keyToRoute = { it },
@@ -81,7 +80,6 @@ class SentryNavigation3IntegrationTest {
81
80
fun`adds breadcrumb with from and to routes`() {
82
81
val observer =
83
82
SentryBackStackObserver(
84
-
backStack = backStack,
85
83
enableNavigationBreadcrumbs =true,
86
84
enableNavigationTracing =false,
87
85
keyToRoute = { it },
@@ -109,7 +107,6 @@ class SentryNavigation3IntegrationTest {
109
107
fun`captures back stack keys in breadcrumb`() {
110
108
val observer =
111
109
SentryBackStackObserver(
112
-
backStack = backStack,
113
110
enableNavigationBreadcrumbs =true,
114
111
enableNavigationTracing =false,
115
112
keyToRoute = { it },
@@ -137,7 +134,6 @@ class SentryNavigation3IntegrationTest {
137
134
fun`does not add breadcrumb when disabled`() {
138
135
val observer =
139
136
SentryBackStackObserver(
140
-
backStack = backStack,
141
137
enableNavigationBreadcrumbs =false,
142
138
enableNavigationTracing =false,
143
139
keyToRoute = { it },
@@ -161,7 +157,6 @@ class SentryNavigation3IntegrationTest {
161
157
162
158
val observer =
163
159
SentryBackStackObserver(
164
-
backStack = backStack,
165
160
enableNavigationBreadcrumbs =false,
166
161
enableNavigationTracing =true,
167
162
keyToRoute = { it },
@@ -191,7 +186,6 @@ class SentryNavigation3IntegrationTest {
191
186
192
187
val observer =
193
188
SentryBackStackObserver(
194
-
backStack = backStack,
195
189
enableNavigationBreadcrumbs =false,
196
190
enableNavigationTracing =true,
197
191
keyToRoute = { it },
@@ -215,7 +209,6 @@ class SentryNavigation3IntegrationTest {
215
209
216
210
val observer =
217
211
SentryBackStackObserver(
218
-
backStack = backStack,
219
212
enableNavigationBreadcrumbs =false,
220
213
enableNavigationTracing =true,
221
214
keyToRoute = { it },
@@ -244,7 +237,6 @@ class SentryNavigation3IntegrationTest {
244
237
245
238
val observer =
246
239
SentryBackStackObserver(
247
-
backStack = backStack,
248
240
enableNavigationBreadcrumbs =false,
249
241
enableNavigationTracing =true,
250
242
keyToRoute = { it },
@@ -272,7 +264,6 @@ class SentryNavigation3IntegrationTest {
272
264
273
265
val observer =
274
266
SentryBackStackObserver(
275
-
backStack = backStack,
276
267
enableNavigationBreadcrumbs =false,
277
268
enableNavigationTracing =true,
278
269
keyToRoute = { it },
@@ -300,7 +291,6 @@ class SentryNavigation3IntegrationTest {
300
291
301
292
val observer =
302
293
SentryBackStackObserver(
303
-
backStack = backStack,
304
294
enableNavigationBreadcrumbs =false,
305
295
enableNavigationTracing =false,
306
296
keyToRoute = { it },
@@ -321,7 +311,6 @@ class SentryNavigation3IntegrationTest {
321
311
322
312
val observer =
323
313
SentryBackStackObserver(
324
-
backStack = backStack,
325
314
enableNavigationBreadcrumbs =false,
326
315
enableNavigationTracing =false,
327
316
keyToRoute = { it },
@@ -342,7 +331,6 @@ class SentryNavigation3IntegrationTest {
342
331
val customBackStack = mutableStateListOf<NavKey>()
343
332
val observer =
344
333
SentryBackStackObserver(
345
-
backStack = customBackStack,
346
334
enableNavigationBreadcrumbs =true,
347
335
enableNavigationTracing =false,
348
336
keyToRoute = { it.route },
@@ -364,7 +352,6 @@ class SentryNavigation3IntegrationTest {
364
352
fun`handles null route from keyToRoute`() {
365
353
val observer =
366
354
SentryBackStackObserver(
367
-
backStack = backStack,
368
355
enableNavigationBreadcrumbs =true,
369
356
enableNavigationTracing =true,
370
357
keyToRoute = { null },
@@ -393,7 +380,6 @@ class SentryNavigation3IntegrationTest {
0 commit comments