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

Compose navigation-based Tracing instead of Activity-level Tracing

Open dalnoki opened this issue 1 month ago • 2 comments

Problem Statement

A customer recently enabled tracing in their Android application. By default, Sentry’s automatic Android tracing creates one trace per Activity. However, their app increasingly relies on Jetpack Compose, where navigation happens within a single Activity. As a result, Activity-level traces are becoming less meaningful for understanding real UI flows.

They would prefer to have performance data at the screen or flow level (i.e., per composable destination) so that individual feature teams can better monitor and diagnose performance issues.

Is there a recommended way to adjust our Sentry configuration so that performance traces align with Compose navigation screens or user flows, rather than Activities? If so, what patterns or APIs should they adopt to achieve more granular and meaningful tracing in a Compose-based app?

Solution Brainstorm

No response

dalnoki avatar Dec 02 '25 13:12 dalnoki

JAVA-262

linear[bot] avatar Dec 02 '25 13:12 linear[bot]

@dalnoki if the customer is using androidx.navigation:navigation-compose then we support this out-of-the-box -- see this doc.

Otherwise they would have to manually instrument their framework/routes, they can get inspired by the aforementioned androidx.navigation instrumentation that we provide here.

romtsn avatar Dec 03 '25 11:12 romtsn