Skip to content

feat(demo-app): use compose-navigation instrumentation for screen tracking - #1979

Merged
breedx-splk merged 2 commits into
open-telemetry:mainfrom
benjoseph-grafana:demo-app-compose-navigation
Aug 13, 2026
Merged

feat(demo-app): use compose-navigation instrumentation for screen tracking#1979
breedx-splk merged 2 commits into
open-telemetry:mainfrom
benjoseph-grafana:demo-app-compose-navigation

Conversation

@benjoseph-grafana

Copy link
Copy Markdown
Contributor

Description

Switches the demo app's astronomy shop to the compose-navigation
instrumentation added in #1964, replacing the bespoke
InstrumentedAstronomyShopNavController wrapper.

The old wrapper emitted a custom event from each navigation helper it
wrapped (navigate.to.product.details, navigate.to.checkout.info,
navigate.to.checkout.confirmation). Navigation that didn't go through
those helpers — bottom navigation bar taps, back/up presses, deep links —
was invisible. rememberObservedNavController observes destination
changes instead, so every completed navigation emits
app.navigation.complete with app.navigation.destination.name.

Also serves as the demo-app example of the screenName override:
astronomyShopScreenName maps route patterns to human-readable names
instead of the default route pattern, and pulls the product id out of the
destination arguments for product details
(Product Details: OLJCESPC7Z).

Changes

  • Add the compose-navigation instrumentation dependency and its
    composite-build substitution.
  • Delete InstrumentedAstronomyShopNavController; call sites now use
    AstronomyShopNavController directly.
  • Add astronomyShopScreenName to map destinations to display names.
  • Document the new instrumentation in the demo app README and remove the
    stale reference to Navigation.kt under Manual Instrumentation.

Testing

Ran the demo app against the local collector and confirmed
app.navigation.complete events appear with the expected
app.navigation.destination.name for each screen, including bottom
nav taps and back presses.
Screenshot 2026-08-10 at 10 32 52 AM

…cking

Replaces the hand-written InstrumentedAstronomyShopNavController wrapper
with rememberObservedNavController from the compose-navigation
instrumentation. The wrapper only emitted events at the call sites it
explicitly wrapped, so bottom navigation bar taps, back/up presses, and
deep links produced no telemetry. Observing destination changes covers
all of them.

Adds an astronomyShopScreenName mapping to demonstrate the screenName
override: destinations resolve to display names (Product List, Cart,
Checkout Info) rather than raw route patterns, and product details reads
the product id out of the destination arguments so the screen name
identifies which product was viewed.
@benjoseph-grafana
benjoseph-grafana marked this pull request as ready for review August 10, 2026 16:08
@benjoseph-grafana
benjoseph-grafana requested a review from a team as a code owner August 10, 2026 16:08
Copilot AI lite review requested due to automatic review settings August 10, 2026 16:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the demo app’s astronomy shop navigation to use the compose-navigation instrumentation (from #1964) for destination-based screen tracking, replacing the bespoke InstrumentedAstronomyShopNavController wrapper so all navigation paths (bottom nav, back/up, deep links) are observed consistently.

Tier: 2 (small internal/demo app change)

Changes:

  • Use rememberObservedNavController to auto-emit app.navigation.complete on destination changes, with a custom astronomyShopScreenName mapping.
  • Remove the bespoke instrumented NavController wrapper and update call sites to use AstronomyShopNavController directly.
  • Add demo-app build substitution + dependency for compose-navigation, and update the demo-app README to document the new behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
demo-app/src/main/java/io/opentelemetry/android/demo/shop/ui/Navigation.kt Switches to rememberObservedNavController, removes the wrapper, and adds a destination→screen-name mapper.
demo-app/src/main/java/io/opentelemetry/android/demo/shop/ui/AstronomyShopActivity.kt Updates the order-placement helper to accept the non-instrumented nav controller type.
demo-app/settings.gradle.kts Adds composite-build substitution for compose-navigation to use the local module during demo-app builds.
demo-app/README.md Documents the compose-navigation instrumentation and removes the stale manual navigation-event reference.
demo-app/build.gradle.kts Adds the compose-navigation instrumentation dependency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread demo-app/src/main/java/io/opentelemetry/android/demo/shop/ui/Navigation.kt Outdated
Comment thread demo-app/src/main/java/io/opentelemetry/android/demo/shop/ui/Navigation.kt Outdated
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.67%. Comparing base (1b921cf) to head (fe0f9cb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1979   +/-   ##
=======================================
  Coverage   65.67%   65.67%           
=======================================
  Files         172      172           
  Lines        3918     3918           
  Branches      442      442           
=======================================
  Hits         2573     2573           
  Misses       1213     1213           
  Partials      132      132           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fractalwrench fractalwrench left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@breedx-splk breedx-splk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, thanks!!

@breedx-splk
breedx-splk merged commit 86cc984 into open-telemetry:main Aug 13, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants