Usage Reporting
Hive Router 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.
Getting Started
Before proceeding, make sure you have created a registry token with write permissions on the Hive dashboard.
Next, set both environment variables:
HIVE_ACCESS_TOKEN: Your Registry Access Token with write permission.HIVE_TARGET: Target reference, either:- slug:
$organizationSlug/$projectSlug/$targetSlug(for examplethe-guild/graphql-hive/staging) - UUID:
a0f4c605-6541-4350-8cfe-b31f21a4bf80
- slug:
To send usage reports, set telemetry.hive.usage_reporting.enabled: true in router.config.yaml.
Example configuration:
Client identification
To identify who’s calling your GraphQL API and view traffic distribution and operation volume per
client in Hive Console, set up client identification in router.config.yaml.
Excluding Operations
You can prevent specific operations from being reported to Hive Console using the exclude option.
It supports two formats that can be used interchangeably.
List of operation names (legacy)
Pass an array of operation names to skip those operations:
Dynamic VRL expression
For more fine-grained control, use a VRL expression that
evaluates at runtime. Return true to exclude the operation or false to include it. The
expression has full access to the request context (.request, .request.headers,
.request.operation.name, .request.operation.type, etc.).
Exclude by operation name:
Exclude traffic from a specific client identified via a request header:
You can check any request header — for example, a custom graphql-client-name header sent by your clients:
Combine multiple conditions:
See Expressions for the full list of available variables and functions.
Sampling
By default, every operation is reported (100%). To reduce the volume of usage reports, configure a
sampling rate under telemetry.hive.usage_reporting.sampling.
At-least-once sampling
A low sampling rate reduces volume, but it can completely miss operations that are rarely executed.
At-least-once sampling solves this: the first request for each unique operation is always
reported, and later requests for the same operation follow the configured rate. This keeps your
report volume low while making sure every distinct operation is visible in Hive Console at least once.
The key defines what makes an operation unique. It accepts one or more of:
operation_name— the name of the GraphQL operationoperation_type— the operation type (query,mutation,subscription)operation_body— the operation body
When you provide multiple values, the router combines them into a single key.
Keys are tracked in memory as 8-byte hashes (~16 bytes per key), up to max_distinct_keys (default
100000). When the limit is reached, the oldest keys are evicted, so a previously seen operation may
be reported as “first seen” again.
Configuration reference
See the telemetry configuration reference for all
options and defaults under telemetry.hive.