Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Android Instrumentation for OkHttp version 3.0 and higher

Status: Experimental

Provides OpenTelemetry instrumentation for okhttp3.

Quickstart

Add these dependencies to your project

Replace OPENTELEMETRY_VERSION with the latest release.

Replace BYTEBUDDY_VERSION with the latest release.

Byte buddy compilation plugin

This plugin leverages Android's Transform API to instrument bytecode at compile time. You can find more info on its repo page.

plugins {
    id 'net.bytebuddy.byte-buddy-gradle-plugin' version 'BYTEBUDDY_VERSION'
}

Project dependencies

implementation("io.opentelemetry.android:okhttp-3.0-library:OPENTELEMETRY_VERSION")
byteBuddy("io.opentelemetry.android:okhttp-3.0-agent:OPENTELEMETRY_VERSION")

After adding the plugin and the dependencies to your project, your OkHttp requests will be traced automatically.

Configuration

You can configure the automatic instrumentation by using the setters from the OkHttpInstrumentation instance provided via the AndroidInstrumentationLoader as shown below:

OkHttpInstrumentation instrumentation = AndroidInstrumentationLoader.getInstrumentation(OkHttpInstrumentation.class);

// Call `instrumentation` setters.

Note

You must make sure to apply any configurations before initializing your OpenTelemetryRum instance (i.e. calling OpenTelemetryRum.builder()...build()). Otherwise your configs won't be taken into account during the RUM initialization process.