opentelemetry-android 1.9.0: Instrumentation Uninstall, Session Sampling, and a Config Default Flip
I looked at the last week of commits in opentelemetry-android, the OpenTelemetry android agent for RUM telemetry. 21 commits landed, covering the v1.8.0 release, the version bump to v1.9.0 on main, and a batch of changes worth knowing about before you upgrade. The headline items: instrumentations can now be uninstalled at runtime, session sampling got a structural rework, and SDK initialization events are off by default.
Instrumentation uninstall support
The contributors landed a steady series of uninstall() implementations across the built in instrumentations. Before this week, once you installed an instrumentation you had little way to remove its telemetry if your app reconfigured the agent at runtime. Now each instrumentation can clean up:
- ANR instrumentation uninstall
- Crash instrumentation uninstall
- Compose click uninstall
- android-log uninstall, HttpURLConnection uninstall, and the OkHttp pair (websocket too)
If you toggle instrumentation based on app state, for example disabling screen tracing on a background service screen, this matters. Previously the safe pattern was to rebuild the SDK; now you can detach a single instrumentation.
Session sampling rework
The sampling code saw the most structural change this week. Session aware trace sampling is now wired during initialization through the internal sampling helpers PR (#2143), so the session ratio sampler is set up as part of the standard builder path rather than as an extra step.
The SessionIdRatioBasedSampler class was also simplified. It now delegates the ratio decision to a SessionIdRatioBasedPredicate, and shouldSample() directly returns RECORD_AND_SAMPLE or DROP based on the session ID. The behavior matches the old trace ID based ratio logic, but the decision lives in one predicate class that can be reused. The previous session context is now exposed through storage as well, which helps when the app process dies and the new session needs to answer “was the previous session sampled”.
Also useful for SDK consumers: OpenTelemetryRumBuilder now holds an internal logRecordFilter predicate applied to its owned batch log processor. Custom log record processors you attach yourself are untouched. That keeps session ratio style filtering inside the agent instead of forcing every app to reimplement it.
Behavior changes for operators
Two defaults changed, and both affect what you see after upgrading.
- SDK initialization events are disabled by default (#2109). If you relied on those events for debug dashboards, you now need to opt back in through core config. The PR still carries a “further discussion needed” label, so expect follow up tweaks.
- Native crash handling got a fix so OTel claims crashes before replay. If you run the native crash instrumentation alongside a crash reporting SDK, ordering now favors the OpenTelemetry handler, which reduces duplicate or lost native crash reports.
Dependency activity
Most of the remaining commits are Renovate bumps, concentrated in gradle/libs.versions.toml: NullAway 0.14.3, Error Prone core 2.51.0, kotlinx serialization JSON 1.12.0, plus broad patch updates. The demo app also pinned the collector contrib image to v0.163.1. Nothing here changes your dependency graph in surprising ways, though the static analysis bumps can surface new lint warnings in your own builds if you mirror these tools.
What to watch
- The v1.9.0 version bump is already on main, (the changelog for 1.8.0 landed just before it), so read the changelog before rebasing on SNAPSHOT builds.
- The initialization events default (#2109) is still marked for further discussion. Watch for a flag or config key that makes opting in easier.
- The uninstall work touched the public API files, for example instrumentation/okhttp3/library/api/library.api, so API validators in downstream forks may need updates if you vendor this code.