Client Awareness
Apollo Studio users can opt-in Client Awareness. Client Awareness allows you to view operation metrics split per client, helping you understand how each one interacts with your graph.
Client Awareness uses apollographql-client-name
and apollographql-client-version
custom HTTP headers to report client usage.
Enable it by adding an ApolloClientAwarenessInterceptor
to your OkHttpClient
:
Kotlin
1 val okHttpClient = OkHttpClient.Builder()
2 .addInterceptor(ApolloClientAwarenessInterceptor(BuildConfig.APPLICATION_ID, BuildConfig.VERSION_NAME))
3 .build()
4
5 instance = ApolloClient.builder()
6 .serverUrl("https://apollo-fullstack-tutorial.herokuapp.com/graphql")
7 .okHttpClient(okHttpClient)
8 .build()
Note: This example uses BuildConfig
to set the applicationId as client name and app version as client version but you can override this. Especially, if your iOS and Android apps use the same package name, it's useful to customize it to allow differentiating the clients