Skip to content

Apollo Usage Reporting

Apollo supports sending operation and field reports to GraphOS.

Sending usage reports

Operation and field reports are sent using a protobuf protocol to https://usage-reporting.api.apollographql.com/api/ingress/traces.

Apollo collects, encodes and sends those reports using the galak-apollo-reporting artifact:

dependencies {
// Add the Apollo monograph artifact
implementation("net.mbonnin.galak:galak-apollo-reporting:0.0.0")
}

To enable reports, configure your ExecutableSchema with a ApolloReportsInstrumentation and matching ApolloReportsContext:

// Get your API key from the environment or secret manager
val apolloKey = System.getenv("APOLLO_KEY")
// Install the ApolloReportsInstrumentation in the executable schema
val schema = ServiceExecutableSchemaBuilder()
.addInstrumentation(ApolloReportsInstrumentation(apolloKey))
.build()
// Create a new ApolloReportsContext() for each operation and use it through execution
val reportsContext = ApolloReportsContext()
val response = schema.execute(request, reportsContext)
// The reports are sent in the background