Skip to content

Conversation

@agrognetti
Copy link
Contributor

@agrognetti agrognetti commented Oct 20, 2025

Summary

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 the dependency androidx.activity:activity.
  • Updating the Android compile SDK version to 36 (Required for the dependency added)

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.

  • SDK:
    • Launch time instrumentation: Add LaunchTimeInstrumentation to record app.launch.duration.ttid and app.launch.duration.ttfd with launch.type and launch.activity attributes.
    • Integration: Wire instrumentation into InstrumentationManager (enabled when metrics are on).
    • Metrics export: Use delta temporality via AggregationTemporalitySelector.deltaPreferred() for OTLP and debug exporters; adjust periodic reader interval to milliseconds.
    • Dependencies/Config: Add androidx.activity:activity; bump compileSdk to 36.
  • E2E demo app:
    • Add UI buttons to trigger new metric types; update ViewModel with recordHistogram, recordCount, recordIncr, recordUpDownCounter and rename gauge metric to test-gauge.
    • Bump compileSdk to 36.

Written by Cursor Bugbot for commit e5c261d. This will update automatically on new commits. Configure here.

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)
@agrognetti agrognetti requested a review from a team as a code owner October 20, 2025 20:06
@agrognetti agrognetti requested review from tanderson-ld and removed request for a team October 20, 2025 20:07
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@tanderson-ld tanderson-ld left a 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.

`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.
cursor[bot]

This comment was marked as outdated.

@tanderson-ld tanderson-ld self-requested a review October 24, 2025 15:04
@agrognetti agrognetti merged commit 38b4a84 into main Oct 24, 2025
22 checks passed
@agrognetti agrognetti deleted the agrognetti/O11Y-362 branch October 24, 2025 19:15
tanderson-ld pushed a commit that referenced this pull request Oct 24, 2025
🤖 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 -->
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.

2 participants