Documentation
Gateway
Usage Reporting

Usage Reporting

Hive Gateway can send usage reports to a schema registry such as the Hive schema registry, but also other providers such Apollo GraphOS.

The Hive Gateway can report usage metrics to the Hive schema registry, giving you insights for executed GraphQL operations, and field level usage information, but also enabling conditional breaking changes. Usage reporting works for both Apollo Federation and Proxy gateways.

Before proceeding, make sure you have created a registry token with write permissions on the Hive dashboard.

Run Hive Gateway with Usage Reporting enabled.
hive-gateway supergraph \
  http://cdn.graphql-hive.com/artifacts/v1/12713322-4f6a-459b-9d7c-8aa3cf039c2e/supergraph \
  --hive-cdn-key "YOUR HIVE CDN KEY" \
  --hive-registry-token "YOUR HIVE REGISTRY TOKEN"

Alternatively, you can also provide the usage reporting configuration via the gateway.config.ts file.

gateway.config.ts
import { defineConfig } from '@graphql-hive/gateway'
 
export const gatewayConfig = defineConfig({
  reporting: {
    // The reporting service type
    type: 'hive',
    // The registry token provided by Hive Registry
    token: 'YOUR HIVE REGISTRY TOKEN'
  }
})