Note: The integration only supports Apollo version 4.
To include the integration for Apollo Kotlin in your project, add the
following to your application's build.gradle.kts file.
dependencies {
implementation("com.datadoghq:dd-sdk-android-okhttp:<latest-version>")
implementation("com.datadoghq:dd-sdk-android-rum:<latest-version>")
implementation("com.datadoghq:dd-sdk-android-apollo:<latest-version>")
}- Set up RUM monitoring with Datadog Android RUM.
- Set up OkHttp instrumentation with the Datadog RUM SDK.
Add the Datadog interceptor to your Apollo Client setup:
val apolloClient = ApolloClient.Builder()
.serverUrl([graphQLEndpoint])
.addInterceptor(DatadogApolloInterceptor())
.okHttpClient([okhttpClientConfiguration])
.build()This automatically adds Datadog headers to your GraphQL requests, allowing them to be tracked
by Datadog. Note that while query and mutation type operations are tracked, subscription operations are not.
GraphQL payload sending is disabled by default. To enable it, set the sendGraphQLPayloads flag in the DatadogApolloInterceptor constructor as follows:
DatadogApolloInterceptor(sendGraphQLPayloads = true)For details on contributing, read the Contributing Guide.