Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.75 KB

File metadata and controls

52 lines (36 loc) · 1.75 KB

Datadog Integration for Coil

Getting Started

To include the Datadog integration for Coil in your project, add the following to your application's build.gradle file.

dependencies {
    implementation "com.datadoghq:dd-sdk-android-rum:<latest-version>"
    implementation "com.datadoghq:dd-sdk-android-okhttp:<latest-version>"
    implementation "com.datadoghq:dd-sdk-android-coil:<latest-version>"
}

Initial Setup

  1. Setup RUM monitoring, see the dedicated Datadog Android RUM Collection documentation to learn how.
  2. Setup OkHttp instrumentation with Datadog RUM SDK, see the dedicated documentation to learn how.

Follow Coil's API documentation to:

  • Create your own ImageLoader by providing your own OkHttpClient (configured with DatadogInterceptor).
    val imageLoader = ImageLoader.Builder(context).okHttpClient(okHttpClient).build()
    Coil.setImageLoader(imageLoader)
  • Decorate the ImageRequest.Builder with the DatadogCoilRequestListener whenever you perform an image loading request.
    imageView.load(uri) {
       listener(DatadogCoilRequestListener())
    }

This automatically tracks Coil's network requests (creating both APM Traces and RUM Resource events), and listens for disk cache errors (creating RUM Error events).

Contributing

For details on contributing, read the Contributing Guide.

License

Apache License, v2.0