Android

Android app monitoring with OpenTelemetry

by Obseria · Frontend, mobile and e-commerce
  • OpenTelemetry
  • Digital Experience
  • Frontend, mobile and e-commerce
Category
Frontend, mobile and e-commerce
Key metrics
8
Ready-made
5 dashboards & alerts
Setup
3 steps
Standard
OTLP

Initialize the OpenTelemetry Android SDK in Application.onCreate and Obseria shows app starts, screen lifecycles, crashes, ANRs, janky frames and network calls from real devices, each request linked to its backend trace.

One dependency, one initializer

The android-agent artifact bundles the standard instrumentations; a single initialize call in your Application class switches them on.

Crashes and ANRs with context

Uncaught exceptions and app-not-responding situations arrive as events with stack trace, session and the screen the user was on.

From tap to backend

OkHttp spans carry W3C trace context, so a slow screen leads to the API and database call behind it.

Obseria interface

Obseria apps and capabilities: observability, APM, infrastructure and integrations
Obseria home dashboard with service health, open problems, SLO compliance and ingestion
Obseria trace explorer with span list and span attributes

Ready the moment data arrives

  • App start time by start type and app version
  • Crashes and ANRs by version, device and screen
  • Alert on new crash types after a release
  • Slowest OkHttp endpoints by status code
  • Janky frames per screen

What the OpenTelemetry Android SDK captures

App start

An AppStart span measures cold, warm and hot starts, distinguished by the start.type attribute.

Activity and fragment lifecycle

Spans named Created, Resumed, Paused, Stopped and Destroyed carry activity.name or fragment.name and the current screen.

Crash reporting

Unhandled exceptions become app.crash events with exception.type, exception.message, exception.stacktrace and thread.

ANR detection

When the main thread is blocked, a device.anr event records the main thread's call stack.

Slow and frozen frames

The slow-rendering instrumentation emits app.jank events when frames exceed the slow or frozen threshold.

Network

OkHttp client spans follow the HTTP semantic conventions, and network.change events record switches between Wi-Fi, cellular and offline.

The Android signals that matter

Obseria collects these values automatically and shows them in ready-made dashboards and alerts.

MetricUnitWhat it tells you
AppStartmsSpan, not a metric: time from process start to the first visible activity, with start.type cold, warm or hot.
Created / ResumedmsSpans, not metrics: activity and fragment lifecycle transitions with activity.name, fragment.name and app.screen.name.
app.crash{event}Log event, not a metric: an exception not handled by app code, with exception.type, exception.stacktrace and thread.name.
device.anr{event}Log event, not a metric: the main thread did not respond; exception.stacktrace holds the main thread's call stack.
app.jank{event}Log event, not a metric: slow or frozen frames in a polling period, with app.jank.frame_count and app.jank.threshold.
HTTP GET / HTTP POSTmsSpan, not a metric: an OkHttp request with http.request.method, url.full, http.response.status_code and server.address.
network.change{event}Log event, not a metric: a change of connectivity, with network.connection.type such as wifi, cell or unavailable.
session.idattributeAttribute on all telemetry from the SDK, so every span and event can be grouped into one user session.

Set up Android monitoring in minutes

  1. 1

    Add the dependency

    Add the OpenTelemetry BOM and io.opentelemetry.android:android-agent to app/build.gradle.kts and pin the version, since the SDK is still pre-1.0.

  2. 2

    Initialize in Application.onCreate

    Call OpenTelemetryRumInitializer.initialize with the Obseria endpoint and a token scoped to mobile ingest only.

  3. 3

    Verify on a device

    Start the app, move between screens and make a few requests; lifecycle, network and app start data appear on the Browser & Mobile page.

Example configuration · KOTLIN
// app/build.gradle.kts — the SDK is pre-1.0, so pin the version
dependencies {
    implementation(platform("io.opentelemetry:opentelemetry-bom:1.51.0"))
    implementation("io.opentelemetry.android:android-agent:0.12.0-alpha")
}

// Application.onCreate — as early as possible, so app start is measured too
import io.opentelemetry.android.OpenTelemetryRumInitializer
import io.opentelemetry.android.config.OtelRumConfig

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        OpenTelemetryRumInitializer.initialize(
            application = this,
            endpointBaseUrl = "${OBSERIA_OTLP_ENDPOINT}",
            // a token scoped to mobile ingest only: anything in the APK is readable
            endpointHeaders = mapOf("Authorization" to "Bearer ${OBSERIA_TOKEN}"),
            rumConfig = OtelRumConfig(),
        )
    }
}

Why Android app monitoring matters

An Android app runs on thousands of device models, OS versions, screen sizes and network conditions. A crash that never happens on the test phone can hit a whole device family, a blocked main thread on an older device turns into an "app isn't responding" dialog, and a slow API looks like a frozen screen to the user. Users rarely report these problems; they uninstall. Android app monitoring shows what happens on real devices and connects it to the backend services the app depends on.

Obseria uses the OpenTelemetry Android SDK for this. It is the OpenTelemetry project's own client for Android and is built on OpenTelemetry Java. The SDK is still pre-1.0 and its API changes between releases, so pin the version and update deliberately. In return, your instrumentation follows open semantic conventions instead of a vendor format.

Signals that matter for Android performance monitoring

  • App start: the AppStart span measures how long users wait before the first screen appears, separated into cold, warm and hot starts via start.type.
  • Screens: lifecycle spans such as Created and Resumed with activity.name and app.screen.name show which screen takes long to become usable.
  • Crashes: app.crash events carry exception type, message, stack trace and thread, so you can group them by cause and app version.
  • ANRs: device.anr events contain the main thread's call stack at the moment it stopped responding, which is exactly where to start debugging.
  • Rendering: app.jank events report slow and frozen frames, the cause of stuttering lists and animations.
  • Network: OkHttp spans show latency and status per endpoint, and network.change events explain failures that happen when the connection drops.

All telemetry carries a session.id, so you can follow one user's session from app start through screens and requests to the crash that ended it.

Common Android app problems and how to detect them

Slow cold starts

Heavy work in Application.onCreate, large dependency graphs or synchronous disk access delay the first frame. A rising AppStart duration for cold starts after a release points to the change that added the work.

Crashes on specific devices

Some crashes only appear on one manufacturer or OS version. Grouping app.crash events by exception type and device attributes shows whether a crash is widespread or limited to a device family.

ANRs from main thread work

Database queries, JSON parsing or network calls on the main thread block the UI. The stack trace in the device.anr event shows the method that held the main thread.

Janky scrolling

Complex layouts and image decoding during scrolling produce slow and frozen frames. app.jank events per screen show where optimization pays off.

Slow or failing APIs

When a screen waits for data, the OkHttp span shows the request and its status. Because it carries trace context, you can follow it into the backend and see whether the API, a database or a third-party service is slow.

Best practices for Android monitoring

  1. Initialize the SDK as early as possible in Application.onCreate so app start and early crashes are captured.
  2. Pin the SDK version and test upgrades, since the API is not yet stable.
  3. Use a token scoped to mobile ingest only and rotate it separately from server tokens; anything in an APK can be extracted.
  4. Set service.version to your app version so crashes and start times can be compared per release.
  5. For automatic OkHttp instrumentation, apply the ByteBuddy Gradle plugin described in the SDK's OkHttp module.
  6. Allow the traceparent header in your API gateway so mobile and backend spans join one trace.

How Obseria helps with Android app monitoring

Obseria receives spans and log events from the OpenTelemetry Android SDK over OTLP and shows them on the Browser & Mobile page. Crashes and ANRs are grouped in the Errors Inbox, ranked by app version and device, and OkHttp spans link to the backend traces they started. Obseria Pipeline masks personal data at ingest, and dashboards, alerts and SLOs work on mobile data exactly as on backend data, so a crash regression after a release can page the team that shipped it.

Learn more

Android monitoring FAQ

It works and it is the OpenTelemetry project's own path for Android, but it is still pre-1.0 and its API changes between releases. Pin the version and update deliberately.

App start, activity and fragment lifecycle, crashes, ANRs, slow and frozen frames and network changes. OkHttp requests are traced through the OkHttp instrumentation, which uses the ByteBuddy Gradle plugin for automatic wiring.

Neither. In current SDK versions crashes are app.crash log events and ANRs are device.anr log events. Obseria groups them into issues in the Errors Inbox.

Anything in an APK can be read by whoever downloads it. Use a token that is limited to mobile ingest and rotate it independently of your server tokens.

The SDK measures activity and fragment lifecycles, app start, crashes, ANRs and rendering regardless of the UI toolkit. For Compose-specific screen names, add your own spans or set the screen name attribute.

Start monitoring Android today

Connect Android in minutes with OpenTelemetry or the Obseria Agent. Free for 14 days.