Skip to content

Commit

Permalink
RUMM-664 Add docs entries for integration with Coil
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusc83 committed Aug 25, 2020
1 parent a6823f4 commit 979b786
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 12 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ If you are using SDK version `0.2.5` or lower, take a look at the [Migration Gui

If your existing codebase is already using Timber, you can migrate to Datadog easily by using the [dedicated library](dd-sdk-android-timber/README.md).

### Integrating with Coil

If you use Coil to load images in your application, take a look at Datadog's [dedicated library](dd-sdk-android-coil/README.md).

### Integrating with Fresco

If you use Fresco to load images in your application, take a look at our [dedicated library](dd-sdk-android-fresco/README.md).
If you use Fresco to load images in your application, take a look at Datadog's [dedicated library](dd-sdk-android-fresco/README.md).

### Integrating with Glide

Expand Down
20 changes: 9 additions & 11 deletions dd-sdk-android-coil/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Getting Started

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

```
Expand All @@ -16,11 +16,11 @@ dependencies {
}
```

### Initial Setup
### Initial setup

Before you can use the SDK, you need to setup the library with your application
context, your Client token and your Application ID.
To generate a Client token and an Application ID please check **UX Monitoring > RUM Applications > New Application**
Before using the SDK, set up the library with your application
context, client token, and application ID.
To generate a client token and an application ID, check **UX Monitoring > RUM Applications > New Application**
in the Datadog dashboard.

```kotlin
Expand All @@ -40,10 +40,9 @@ class SampleApplication : Application() {
}
```

Following Coil's [API documentation][2], you then need to:
Follow Coil's [API documentation][2] to:

- Create your own `ImageLoader` by providing your own `OkHttpClient` having the `DatadogInterceptor` attached,
and register it.
- Create your own `ImageLoader` by providing your own OkHttpClient (configured with `DatadogInterceptor`).

```kotlin
val imageLoader = ImageLoader.Builder(context).okHttpClient(okHttpClient).build()
Expand All @@ -58,12 +57,11 @@ and register it.
}
```

Doing so will automatically track Coil's network requests (creating both APM Traces and RUM Resource events), and will also listen for disk cache errors (creating RUM Error events).
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

Pull requests are welcome, but please open an issue first to discuss what you
would like to change. For more information, read the
For details on contributing, read the
[Contributing Guide](../CONTRIBUTING.md).

## License
Expand Down
40 changes: 40 additions & 0 deletions docs/coil_integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Android Coil Integration

Enrich your RUM dashboard with [Coil][1] specific information.

**Note**: This package is an extension of the main package, so add both dependencies into your gradle file.

## Setup

```configure
repositories {
maven { url "https://dl.bintray.com/datadog/datadog-maven" }
}
dependencies {
implementation "com.datadoghq:dd-sdk-android:x.x.x"
implementation "com.datadoghq:dd-sdk-android-coil:x.x.x"
}
```

### Coil integration setup

Follow Coil's [API documentation][2] to:

- Create your own `ImageLoader` by providing your own OkHttpClient (configured with `DatadogInterceptor`).

```kotlin
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.

```kotlin
imageView.load(uri){
listener(DatadogCoilRequestListener())
}
```

[1]: https://github.com/coil-kt/coil
[2]: https://coil-kt.github.io/coil/getting_started/

0 comments on commit 979b786

Please sign in to comment.