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>"
}
- Setup RUM monitoring, see the dedicated Datadog Android RUM Collection documentation to learn how.
- Setup OkHttp instrumentation with Datadog RUM SDK, see the dedicated documentation to learn how.
- Following Fresco's Generated API documentation, you need to create your own
OkHttpImagePipelineConfigFactory
by providing your ownOkHttpClient
(configured withDatadogInterceptor
). You can also add an instance ofDatadogFrescoCacheListener
in yourDiskCacheConfig
.
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)
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.