Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.97 KB

File metadata and controls

49 lines (36 loc) · 1.97 KB

Datadog Integration for Fresco

Getting Started

To include the Datadog integration for Fresco in your project, simply 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-fresco:<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.
  3. Following Fresco's Generated API documentation, you need to create your own OkHttpImagePipelineConfigFactory by providing your own OkHttpClient (configured with DatadogInterceptor). You can also add an instance of DatadogFrescoCacheListener in your DiskCacheConfig.

Doing so will automatically track Fresco's network requests (creating both APM Traces and RUM Resource events), and will also listen for disk cache errors (creating RUM Error events).

    val config = OkHttpImagePipelineConfigFactory.newBuilder(context, okHttpClient)
        .setMainDiskCacheConfig(
            DiskCacheConfig.newBuilder(context)
                .setCacheEventListener(DatadogFrescoCacheListener())
                .build()
        )
        .build()
    Fresco.initialize(context, config)

Contributing

Pull requests are welcome, but please open an issue first to discuss what you would like to change. For more information, read the Contributing Guide.

License

Apache License, v2.0