-
Notifications
You must be signed in to change notification settings - Fork 2
feat: O11Y-601 - Add Android launch time instrumentation #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This change introduces caching for OpenTelemetry metric instruments (Gauge, Counter, Histogram, UpDownCounter) within the `InstrumentationManager`. Previously, a new instrument was built for every metric recording call (`recordMetric`, `recordCount`, etc.), which is inefficient. Now, instruments are created once per metric name and reused for subsequent calls, improving performance.
This change updates the Android observability SDK to use delta aggregation temporality for metrics. The `recordIncr` method for counters now correctly increments the value, which is then reset after export. Additionally, new metric types have been added to the e2e test application for more comprehensive testing: * Histogram * Count * Incremental Counter * UpDownCounter A UI fix using `imePadding` has also been applied to the e2e app to prevent the keyboard from obscuring input fields.
This commit introduces automatic instrumentation for Android application launch times. It measures and reports two key metrics: - Time to Initial Display (TTID) - Time to Full Display (TTFD) The instrumentation classifies launches as `cold`, `warm`, or `hot` and records the durations as histogram metrics (`app.launch.duration.ttid` and `app.launch.duration.ttfd`). These metrics include attributes for the launch type and the specific activity being launched. The implementation also includes: - Adding a dependency on `androidx.activity`. - Updating the Android compile SDK version to 36 (Required for the dependency added)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No specific changes requested. Consider adding tests where possible.
I just have a general feeling that there may be a problematic state that can arise from an unexpected ordering of callbacks / race condition, but if every callback is known to come on one thread (the main thread), then unit tests should be enough to cover it.
...droid/lib/src/main/kotlin/com/launchdarkly/observability/client/LaunchTimeInstrumentation.kt
Show resolved
Hide resolved
...droid/lib/src/main/kotlin/com/launchdarkly/observability/client/LaunchTimeInstrumentation.kt
Show resolved
Hide resolved
...droid/lib/src/main/kotlin/com/launchdarkly/observability/client/LaunchTimeInstrumentation.kt
Outdated
Show resolved
Hide resolved
`LaunchTimeInstrumentation` now implements `AndroidInstrumentation` and is registered using `rumBuilder.addInstrumentation(it)`. The initialization logic for `LaunchTimeInstrumentation` is moved into the `install` method, which is called by the OpenTelemetry SDK.
...droid/lib/src/main/kotlin/com/launchdarkly/observability/client/LaunchTimeInstrumentation.kt
Show resolved
Hide resolved
...droid/lib/src/main/kotlin/com/launchdarkly/observability/client/LaunchTimeInstrumentation.kt
Show resolved
Hide resolved
🤖 I have created a release *beep* *boop* --- <details><summary>launchdarkly-observability-android: 0.12.0</summary> ## [0.12.0](launchdarkly-observability-android-0.11.0...launchdarkly-observability-android-0.12.0) (2025-10-24) ### Features * Android observability plugin session replay support ([#268](#268)) ([4ba5124](4ba5124)) * O11Y-601 - Add Android launch time instrumentation ([#274](#274)) ([38b4a84](38b4a84)) </details> <details><summary>observability: 0.4.6</summary> ## [0.4.6](observability-0.4.5...observability-0.4.6) (2025-10-24) ### Dependencies * The following workspace dependencies were updated * dependencies * highlight.run bumped to 9.22.3 </details> <details><summary>session-replay: 0.4.6</summary> ## [0.4.6](session-replay-0.4.5...session-replay-0.4.6) (2025-10-24) ### Dependencies * The following workspace dependencies were updated * dependencies * highlight.run bumped to 9.22.3 </details> <details><summary>highlight.run: 9.22.3</summary> ## [9.22.3](highlight.run-9.22.2...highlight.run-9.22.3) (2025-10-24) ### Bug Fixes * avoid noisy error log on starting new sessions ([#269](#269)) ([e76004c](e76004c)) * make sessionCookie session a boolean type ([#272](#272)) ([9fb304d](9fb304d)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Publish new Android, Web Observability, and Session Replay releases plus highlight.run 9.22.3 with minor features and fixes, and bump internal dependencies accordingly. > > - **SDK releases**: > - **Android (`sdk/@launchdarkly/observability-android`) 0.12.0**: > - Add session replay support in the Android observability plugin. > - Add Android launch time instrumentation. > - **Web Observability (`sdk/@launchdarkly/observability`) 0.4.6**: > - Dependency: `highlight.run` -> `9.22.3`. > - **Session Replay (`sdk/@launchdarkly/session-replay`) 0.4.6**: > - Dependency: `highlight.run` -> `9.22.3`. > - **highlight.run (`sdk/highlight-run`) 9.22.3**: > - Bug fixes: reduce noisy error log on new sessions; make `sessionCookie.session` a boolean. > - **Version manifests**: > - Update `.release-please-manifest.json` and package versions to match releases. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1081a4c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Summary
This commit introduces automatic instrumentation for Android application launch times. It measures and reports two key metrics:
The instrumentation classifies launches as
cold,warm, orhotand records the durations as histogram metrics (app.launch.duration.ttidandapp.launch.duration.ttfd). These metrics include attributes for the launch type and the specific activity being launched.The implementation also includes:
androidx.activity:activity.Note
Adds Android launch-time metrics (TTID, TTFD), integrates instrumentation into the SDK, switches metrics export to delta temporality, and updates compileSdk to 36 with new metric APIs and demo triggers.
LaunchTimeInstrumentationto recordapp.launch.duration.ttidandapp.launch.duration.ttfdwithlaunch.typeandlaunch.activityattributes.InstrumentationManager(enabled when metrics are on).AggregationTemporalitySelector.deltaPreferred()for OTLP and debug exporters; adjust periodic reader interval to milliseconds.androidx.activity:activity; bumpcompileSdkto36.ViewModelwithrecordHistogram,recordCount,recordIncr,recordUpDownCounterand rename gauge metric totest-gauge.compileSdkto36.Written by Cursor Bugbot for commit e5c261d. This will update automatically on new commits. Configure here.