Configure the Splunk Android RUM instrumentation 🔗
You can configure the Android RUM agent from the Splunk OpenTelemetry Instrumentation for Android to add custom attributes, adapt the instrumentation to your environment and application, customize sampling, and more.
To configure the Android RUM agent, pass the settings by preparing a Config
instance using the fluent builder API. The following example shows how to configure the RUM token, Splunk realm, and application name:
class MyApplication extends Application {
private final String realm = "<realm>";
private final String rumAccessToken = "<your_RUM_access_token>";
@Override
public void onCreate() {
super.onCreate();
SplunkRum.builder()
.setApplicationName("<name_of_app>")
.setRealm("<realm>"")
.setRumAccessToken("<rumAccessToken>")
.build(this);
}
}
General settings 🔗
Use the following settings to configure the Android RUM agent:
Option |
Description |
---|---|
|
RUM token that authorizes the agent to send telemetry to Splunk Observability Cloud. To generate a RUM access token, see Generate your RUM access token in Splunk Observability Cloud. |
|
Realm in Splunk Observability Cloud, used to generate the endpoint URL. For example, |
|
Use this method instead of |
|
Sets the name of the application. |
|
Sets the environment attribute on the spans that are generated by the instrumentation. |
|
Attributes to append to every span collected. For an example, see Manage global attributes. |
|
Use this setting to filter or customize spans. For example, you can use |
|
Activates storage-based buffering of telemetry. This setting is useful when instrumenting applications that might work offline for extended periods of time. |
|
Sets the maximum amount of storage to use for disk buffering. The default value is 25 MB. Requires |
|
Activates session ID based sampling and sets a sampling ratio. The sampling ratio is the probability of a session being included between. Values range between |
|
Activates debug mode. This feature is inactive by default. Activating debug mode activates the OpenTelemetry logging span exporter, which might be useful when debugging instrumentation issues. |
|
Activates the experimental OTLP exporter. The exporter is not compatible with disk buffering. |
Instrumentation settings 🔗
Use the following settings to activate or deactivate the collection of specific data:
Option |
Description |
---|---|
|
Deactivates instrumentation for application subprocesses. Accepts an application ID value. |
|
Enables the deferrment of background telemetry until the app is foregrounded. Used to connect background session data to a real user session. |
|
Deactivates crash reporting. This feature is activated by default. |
|
Deactivates ANR (Application not responding) detection and reporting. This feature is activated by default. |
|
Deactivates network monitoring. This feature is activated by default. |
|
Deactivates the detection of slow frame renders. This feature is activated by default. Splunk RUM defines renders as slow or frozen following the Android Vitals definition of the Android Developers documentation. |
|
Sets the default polling interval for slow or frozen render detection. The default value is |
HTTP instrumentation settings 🔗
The Android RUM agent includes instrumentation for the OkHttp and Volley HTTP clients.
OkHttp 🔗
Instrument OkHttp using the Call.Factory
wrapper, as in the following example:
private Call.Factory buildOkHttpClient(SplunkRum splunkRum) {
return splunkRum.createRumOkHttpCallFactory(new OkHttpClient());
}
Volley HTTP (Experimental) 🔗
To instrument Volley HTTP, add the splunk-otel-android-volley
dependency to the build.gradle.kts
file:
dependencies {
//...
implementation("com.splunk:splunk-otel-android-volley:+")
//...
}
Use the VolleyTracing
class to create an instance of VolleyTracing
, as in the following example:
VolleyTracing volleyTracing = VolleyTracing.builder(splunkRum).build();
The following example shows how to retrieve an instance of HurlStack
from your volleyTracing
instance:
HurlStack hurlStack = volleyTracing.newHurlStack();
You can then use the hurlStack
instance to create your request queue and send requests as usual.
Capture additional request and response headers 🔗
You can capture additional request and response headers using the HTTP instrumentations. Additional headers appear with the http.request.header.
and http.response.header.
prefixes.
To capture additional headers, provide the builder with a list of headers to catch. For example:
builder.setCapturedRequestHeaders(asList("X-My-Custom-Request-Header"))
builder.setCapturedResponseHeaders(asList("X-My-Custom-Response-Header"))
The resulting span contains an http.request.header.x_my_custom_header
attribute with one or more header values.