Add tail-based sampling rate to Hive Console OpenTelemetry tracing#2134
Draft
Add tail-based sampling rate to Hive Console OpenTelemetry tracing#2134
Conversation
Co-authored-by: ardatan <20847995+ardatan@users.noreply.github.com>
…rror-always-report behavior Co-authored-by: ardatan <20847995+ardatan@users.noreply.github.com> Agent-Logs-Url: https://github.com/graphql-hive/gateway/sessions/0e83b079-a582-4db0-b4e9-a80049e2cec4
Co-authored-by: ardatan <20847995+ardatan@users.noreply.github.com> Agent-Logs-Url: https://github.com/graphql-hive/gateway/sessions/989fb9ae-b276-4657-9dfe-1beae4a8e12a
Copilot
AI
changed the title
[WIP] Add control over GraphQL request sampling
Add tail-based sampling rate to Hive Console OpenTelemetry tracing
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hiveTracingSetuppreviously had no way to sample successful traces — everything was always reported to Hive Console. This adds a tail-basedsamplingRateoption that always reports traces containing GraphQL errors while sampling successful traces at a configurable rate.API changes
hiveTracingSetupaccepts a newsamplingRate?: number(0–1, default1). Distinct from the OTEL head-basedsamplingRateinopenTelemetrySetup— this is evaluated after spans are collected, so error traces are never dropped.samplercan still be provided alongside for head-based sampling.HiveTracingSpanProcessorOptionsexposessamplingRateon both the endpoint and custom-processorvariants.Implementation
HiveTracingSpanProcessor: sampling decision is made inonEndwhen the HTTP root span closes and error counts are known. Traces withSEMATTRS_HIVE_GRAPHQL_ERROR_COUNT > 0bypass the rate check entirely.hiveTracingSetup: replaced{...options}spread intoopenTelemetrySetupwith an explicit field list to avoid forwarding Hive-specific fields (processor,accessToken,samplingRate, etc.) that are not part ofOpentelemetrySetupOptions— this also resolves TypeScript discriminated-union conflicts betweenHiveSamplingOptionsandSamplingOptions.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
rover.apollo.dev/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node ./install.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.