HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center

Instrumentation for Android

This page explains the automatic and custom instrumentations offered among multiple APM metrics for Android apps.

Spans

Spans allow you to understand better the root causes of the latencies that occur during your app’s launch and screen loading. This section provides a detailed breakdown of the duration of the platform life cycle stages, network calls, and more information during the app launch and screen loading.

Spans Table Breakdown

Span NameThis shows the stage or request name to identify its source.
P50This is the 50th percentile, which is the maximum latency that 50% of all the occurrences have in the selected time period and is shown in ms.
P95This is the 95th percentile, which is the maximum latency that 95% of all the occurrences have in the selected time period and is shown in ms.
P50 & P95 ChangeThis shows the change rate of P50 & P95 durations in comparison to the last period based on the selected date filter.
Average CallsThis shows how many times the span happened per single occurrence to understand its redundancy better. To get the overall duration of this span, multiply the Average Call by the P50/P95.
FrequencyThis is how many times the span happened per all occurrences of the specified metric.

Supported Span Types

These are the currently supported Span Types:

  • View Loading
  • Network
  • App Initialization
  • Fragments Loading
  • Composable Loading

📘

If you are using the EndAppLaunch or EndScreenLoading APIs, Instabug captures the duration from the start of the app launch or screen loading up until the call of any of both APIs.

Fragments

Instabug does not capture Fragments by default on Android, so you can use the following steps to capture and display them on your dashboard.

  1. Add the below dependency to your project's build.gradle file.
buildscript {
    dependencies {
        // ...
        classpath 'com.instabug.library:instabug-plugin:x.x.x' // Replace x.x.x with your current SDK version
    }
}
  1. Add the below plugin to your application's build.gradle file.
apply plugin: 'instabug-apm'

Instabug {
    APM {
        fragmentSpansEnabled true
    }
}

📘

Instabug supports Fragments starting from androidx.fragment:fragment:1.2.0 or above and starting from SDK version 11.7.0.

Enable/Disable Fragments

Capturing Fragments can be enabled or disabled accordingly by using the API below:

//Enable
APM.setFragmentSpansEnabled(true)
//Disble
APM.setFragmentSpansEnabled(false)
//Enable
APM.setFragmentSpansEnabled(true)
//Disble
APM.setFragmentSpansEnabled(false)

Composable Loading

Composable views are supported on several products in different forms. When it comes to Performance Monitoring, we capture the composable views loading that took place in the App Launch or Screen Loading as a span inside the Activity and show it in the spans table.

You can read more about configuring Instabug to capture composable loading and stability here.

Spans Table in Network Metric

To help you have a better understanding of what's causing the bulk delays inside your network calls, either from the Client, Server, or Network sides, you'll be able to see a detailed breakdown of the latencies caused by the stages/operations that were made to send the network request and receive its response from the server on aggregation and occurrence levels inside the network metric.

You can read more about the Spans table in Network Metric here.