Skip to content

Commit b516cf3

Browse files
authored
Overload withSentryObservableEffect to provide compose instrumentation hook(getsentry#2320)
1 parent 0fbe535 commit b516cf3

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
- Provide hook for Jetpack Compose navigation instrumentation ([#2320](https://github.com/getsentry/sentry-java/pull/2320))
7+
38
## 6.6.0
49

510
### Fixes

sentry-compose/src/androidMain/kotlin/io/sentry/compose/SentryNavigationIntegration.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ internal class SentryLifecycleObserver(
3737

3838
/**
3939
* A [DisposableEffect] that captures a [Breadcrumb] and starts an [ITransaction] and sends
40-
* them to Sentry for when attached to the respective [NavHostController].
40+
* them to Sentry for every navigation event when being attached to the respective [NavHostController].
4141
*
4242
* @param enableNavigationBreadcrumbs Whether the integration should capture breadcrumbs for
4343
* navigation events.
@@ -73,3 +73,18 @@ public fun NavHostController.withSentryObservableEffect(
7373
}
7474
return this
7575
}
76+
77+
/**
78+
* A [DisposableEffect] that captures a [Breadcrumb] and starts an [ITransaction] and sends
79+
* them to Sentry for every navigation event when being attached to the respective [NavHostController].
80+
*
81+
* Used by the sentry android gradle plugin for Jetpack Compose instrumentation.
82+
*
83+
*/
84+
@Composable
85+
internal fun NavHostController.withSentryObservableEffect(): NavHostController {
86+
return withSentryObservableEffect(
87+
enableNavigationBreadcrumbs = true,
88+
enableNavigationTracing = true
89+
)
90+
}

0 commit comments

Comments
 (0)