sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Compose Navigation - spans not linking to navigation created transaction

Open nathan-castlehow opened this issue 1 year ago • 1 comments

Integration

sentry-android

Build System

Gradle

AGP Version

8.3.2

Proguard

Enabled

Version

7.16.0

Steps to Reproduce

Was chatting to support and asked to add info here. (#137117)

App is is setup using the following

Plugins

    id("io.sentry.android.gradle") version "4.13.0"
    id("io.sentry.kotlin.compiler.gradle") version "4.13.0"

Libraries

sentry-base = "io.sentry:sentry-android:7.16.0"
sentry-compose = "io.sentry:sentry-compose-android:7.16.0"

When clicking around the app we eventually see relevant navigation transactions (as a result of the sentry plugin hooking into the navigation) However all the spans are grouped inside the main activity transaction.

Main Activity Transaction Image

Navigation Transaction Image

Expected Result

For all related spans to be correctly grouped under each navigation transaction

Actual Result

See steps to reproduce. Spans are being grouped under main activity transaction.

nathan-castlehow avatar Nov 19 '24 06:11 nathan-castlehow

The specific issue is occuring because right now the SDK side screen tracking is based on Activities, paired with a timing issue we're facing the issue above. So overall this is closely related to https://github.com/getsentry/sentry-java/issues/2981. In this case we should have a screen tracking approach which is based on Compose Navigation, so every route change yields a new screen, where we can attach the correct @Composable timings to.

markushi avatar Apr 07 '25 12:04 markushi