Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ animalsniffer = "2.0.1"
apollo = "2.5.9"
androidxLifecycle = "2.2.0"
androidxNavigation = "2.9.8"
androidxNavigation3 = "1.1.5"
androidxTestCore = "1.7.0"
androidxCompose = "1.9.5"
asyncProfiler = "4.4"
Expand Down Expand Up @@ -109,6 +110,8 @@ androidx-lifecycle-process = { module = "androidx.lifecycle:lifecycle-process",
androidx-navigation-runtime = { module = "androidx.navigation:navigation-runtime", version.ref = "androidxNavigation" }
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidxNavigation" }
androidx-navigation-fragment = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "androidxNavigation" }
androidx-navigation3-runtime = { module = "androidx.navigation3:navigation3-runtime", version.ref = "androidxNavigation3" }
androidx-navigation3-ui = { module = "androidx.navigation3:navigation3-ui", version.ref = "androidxNavigation3" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room2" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room2" }
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room2" }
Expand Down
3 changes: 3 additions & 0 deletions sentry-samples/sentry-samples-android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ You can also apply the [Sentry Android Gradle Plugin](https://github.com/getsent

In Android Studio, add `useSagp=` (empty value) to `gradle.properties`, or pass `-PuseSagp` as a Gradle project property.

For LLM-driven verification, use `adb` to inspect and interact with the running emulator. Compose-based screens often expose stable
`Modifier.testTag()` values, which can be used with the UI hierarchy dump to locate controls reliably.

## Build modes

### With or without SAGP
Expand Down
3 changes: 3 additions & 0 deletions sentry-samples/sentry-samples-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ dependencies {
implementation(projects.sentryAndroid)
implementation(projects.sentryAndroidFragment)
implementation(projects.sentryAndroidNavigation)
implementation(projects.sentryAndroidNavigation3)
implementation(projects.sentryAndroidSqlite)
implementation(projects.sentryAndroidTimber)
implementation(projects.sentryCompose)
Expand All @@ -212,6 +213,8 @@ dependencies {
implementation(libs.androidx.compose.material.icons.extended)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.navigation.fragment)
implementation(libs.androidx.navigation3.runtime)
implementation(libs.androidx.navigation3.ui)
implementation(libs.androidx.recyclerview)
implementation(libs.androidx.browser)
implementation(libs.androidx.room3.runtime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Main" />

<activity
android:name=".navigation.nav3.Nav3SetupActivity"
android:exported="false"
android:theme="@style/AppTheme.Main" />

<activity
android:name=".navigation.nav3.Nav3Activity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Main" />

<activity
android:name=".FrameDataForSpansActivity"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import io.sentry.compose.SentryTraced
import io.sentry.protocol.Feedback
import io.sentry.protocol.User
import io.sentry.samples.android.memory.MemoryLimiterActivity
import io.sentry.samples.android.navigation.nav3.Nav3SetupActivity
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
Expand Down Expand Up @@ -912,6 +913,16 @@ fun IntegrationsScreen() {
}
}
}
item {
SentryTraced("open_nav3_activity") {
OutlinedButton(
onClick = { activity.startActivity(Intent(activity, Nav3SetupActivity::class.java)) },
modifier = Modifier,
) {
Text("Open Nav3 Activity", maxLines = 2, overflow = TextOverflow.Ellipsis)
}
}
}
item {
SentryTraced("open_sample_fragment") {
OutlinedButton(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Nav2 and Nav3 Samples

## Nav Sample Transaction Tips

When inspecting route-level transactions from `Nav2Activity` or `Nav3Activity`, note that the sample app also enables automatic Activity
tracing by default. That can produce overlapping `ui.load` transactions for the Activity itself, which may make it harder to isolate the
navigation transactions generated by the Nav2 or Nav3 integrations.

If you want the route transactions to be the primary trace surface while testing those sample screens, temporarily disable automatic
Activity tracing in `src/main/AndroidManifest.xml`:

```xml
<meta-data
android:name="io.sentry.traces.activity.enable"
android:value="false" />
```

This is mainly useful for debugging and comparison in the sample app. It is not a general recommendation for production apps.

## Navigation Performance Scenarios

Both navigation samples include an interactive performance scenario for exercising stack mutations and route rendering.

### Nav2

Open Nav2 from the integrations screen, select the `Performance` tab, and use the controls to build a stack or replace the top destination.
The sample also supports automatic recompositions and navigation for sustained stress testing.

### Nav3

Open Nav3 from the integrations screen, select the `Performance` tab, and use the presets or performance controls to run a scenario with the
desired stack depth, workload, integration mode, and argument shape.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ internal data class Nav2TraceSpan(
private fun SentryTransaction.toNav2TransactionTrace(dsn: String?): Nav2TransactionTrace {
val trace = contexts.trace
val startTimestamp = startTimestamp
val endTimestamp = timestamp ?: startTimestamp
val endTimestamp =
timestamp ?: spans.mapNotNull { span -> span.timestamp }.maxOrNull() ?: startTimestamp
val durationMillis = ((endTimestamp - startTimestamp) * 1_000.0).coerceAtLeast(0.0)
val rootSpanId = trace?.spanId?.toString()
val traceId = trace?.traceId?.toString().orEmpty()
Expand Down
Loading
Loading