Note: The integration supports Apollo iOS version 1.0+.
To include the integration for Apollo iOS in your project, add the following to your Package.swift file:
dependencies: [
.package(url: "https://github.com/DataDog/dd-sdk-ios-apollo-interceptor", .upToNextMajor(from: "1.0.0"))
]Alternatively, you can add it using Xcode:
- Go to File → Add Package Dependencies
- Enter the repository URL:
https://github.com/DataDog/dd-sdk-ios-apollo-interceptor - Select the latest version
- Set up RUM monitoring with Datadog iOS RUM SDK
- Set up network instrumentation with the Datadog RUM SDK for iOS
- Add the Datadog interceptor to your Apollo Client setup:
import Apollo
import DatadogApollo
class CustomInterceptorProvider: DefaultInterceptorProvider {
override func interceptors<Operation: GraphQLOperation>(for operation: Operation) -> [ApolloInterceptor] {
var interceptors = super.interceptors(for: operation)
interceptors.insert(DatadogApolloInterceptor(), at: 0)
return interceptors
}
}This automatically adds Datadog headers to your GraphQL requests, enabling them to be tracked by Datadog. Note that while query and mutation operations are tracked, subscription operations are not.
Sending GraphQL payloads is disabled by default. To enable it, set the sendGraphQLPayloads flag in the DatadogApollo interceptor constructor as shown below:
let datadogInterceptor = DatadogApolloInterceptor(sendGraphQLPayloads: true)Contributions are welcome! For details, see the Contributing Guide.
Apache License, v2.0