Skip to content

Automatic navigation instrumentation for Jetpack Navigation 3 (with NavDisplay / custom back stack) #5948

Description

@cstavitsky

Problem Statement

Opening on behalf of a trialing customer.

Possibly related to prior Navigation 3 / navigation instrumentation discussion: #5000, #5649, #5650. However, I don't have this level of depth in Android experience and wanted to ask the team's advice on how to approach this problem.

Customer is instrumenting an Android app that uses Jetpack Navigation 3 with NavDisplay, driven by a custom navigator that exposes a backStack. An example of the nav stack:

NavDisplay(
    backStack = navigator.backStack,
)

which is defined as:

@Composable
public fun <T : Any> NavDisplay(
    backStack: List<T>,
)

So basically a list - the concrete implementation is a SnapshotStateList.

Today the SDK's navigation auto-instrumentation doesn't cover this pattern, so there's no out-of-the-box way to emit navigation breadcrumbs or screen-load transactions when the back stack changes. Navigation is one of the most useful breadcrumb sources for debugging, so this is a meaningful gap for teams adopting Navigation 3.

Environment

SDK: sentry-android (Android)
Navigation: Jetpack Navigation 3 (NavDisplay) with a custom navigator exposing a SnapshotStateList back stack

Solution Brainstorm

Customer: "The main thing we're interested in is a way for sentry to tie in to that specific implementation of NavDisplay where we are providing a list of keys. Because with [the implementation described in the above linked issues], I think the nav controller is abstracted away from us since we are the ones in complete control of the entire navigation stack now"

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions