Sending Apollo Router operation metrics to GraphOS
The Apollo Router can report operation usage metrics to GraphOS that you can then visualize in GraphOS Studio. These metrics also enable powerful GraphOS features like schema checks.
Enabling usage reporting
You enable usage reporting in the Apollo Router by setting the following environment variables:
export APOLLO_KEY=<YOUR_GRAPH_API_KEY>export APOLLO_GRAPH_REF=<YOUR_GRAPH_ID>@<VARIANT_NAME>
For more information, see Sending operation metrics to GraphOS.
Reporting field-level traces
In their responses to your router, your subgraphs can include field-level traces that indicate how long the subgraph took to resolve each field in an operation. By analyzing this data in GraphOS Studio, you can identify and optimize your slower fields:

Your subgraph libraries must support federated tracing (also known as FTV1 tracing) to provide this data.
- To confirm support, check the
FEDERATED TRACING
entry for your library on this page. - Consult your library's documentation to learn how to enable federated tracing.
- If you use Apollo Server with
@apollo/subgraph
, federated tracing support is enabled automatically.
- If you use Apollo Server with
Trace sampling rate
By default, the Apollo Router requests subgraph trace data for 1% of operations. In most cases, this provides a sufficient sample size while minimizing latency for most operations (traces can affect latency because they increase the size of subgraph response payloads).
You can customize your router's trace sampling rate by setting the following options in your YAML config file:
telemetry:apollo:# In this example, the router will request traces for 50% of requests.# This value can't exceed the value of tracing.common.sampler.field_level_instrumentation_sampler: 0.5tracing:common:# FTV1 uses the same trace sampling as other tracing options,# so this value is also required.sampler: 0.5
ⓘ NOTE
Because field-level instrumentation is dependent on general-purpose OpenTelemetry tracing, the value of apollo.field_level_instrumentation_sampler
cannot exceed the value of tracing.common.sampler
.
Disabling field-level traces
To completely disable requesting and reporting subgraph trace data, set field_level_instrumentation_sampler
to always_off
:
telemetry:apollo:field_level_instrumentation_sampler: always_off
Advanced configuration
send_headers
Provide this field to configure which request header names and values are included in trace data that's sent to GraphOS. By default, no header information is sent to GraphOS as a security measure.
telemetry:apollo:field_level_instrumentation_sampler: 0.01 # (default)send_headers:only: # Include only headers with these names- referer
Supported values:
Value / Type | Description |
---|---|
| Set
This is the default behavior. |
| Set
⚠️ Use with caution! Headers might contain sensitive data (such as access tokens) that should not be reported to GraphOS. |
| An array of names for the headers that the router will report to GraphOS. All other headers are not reported. See the example above. |
| An array of names for the headers that the router will not report to GraphOS. All other headers are. Uses the same format as the |
send_variable_values
Provide this field to configure which GraphQL variable values are included in trace data that's sent to GraphOS. By default, no variable information is sent to GraphOS as a security measure.
telemetry:apollo:field_level_instrumentation_sampler: 0.01 # (default)send_variable_values:except: # Send all variables EXCEPT ones with these names- first
Supported values:
Value / Type | Description |
---|---|
| Set
This is the default behavior. |
| Set
⚠️ Use with caution! GraphQL variables might contain sensitive data that should not be reported to GraphOS. |
| An array of names for the variables that the router will report to GraphOS. All other variables are not reported. Uses the same format as the |
| An array of names for the variables that the router will not report to GraphOS. All other variables are reported. See the example above. |
telemetry:apollo:# The percentage of requests will include HTTP request and response headers in traces sent to Apollo Studio.# This is expensive and should be left at a low value.# This cannot be higher than tracing->common->samplerfield_level_instrumentation_sampler: 0.01 # (default)# Include HTTP request and response headers in traces sent to Apollo Studiosend_headers: # other possible values are all, only (with an array), except (with an array), none (by default)except: # Send all headers except referer- referer# Include variable values in Apollo in traces sent to Apollo Studiosend_variable_values: # other possible values are all, only (with an array), except (with an array), none (by default)except: # Send all variable values except for variable named first- firsttracing:common:sampler: 0.5 # The percentage of requests that will generate traces (a rate or `always_on` or `always_off`)
errors
You can configure whether the Apollo Router reports GraphQL error information to GraphOS, and whether the details of those errors are redacted. You can customize this behavior globally and override that global behavior on a per-subgraph basis.
By default, your router does report error information, and it does redact the details of those errors.
- To prevent your router from reporting error information at all, you can set the
send
option tofalse
. - To include all error details in your router's reports to GraphOS, you can set the
redact
option tofalse
.
Your subgraph libraries must support federated tracing (also known as FTV1 tracing) to provide errors to GraphOS. If you use Apollo Server with @apollo/subgraph
, federated tracing support is enabled automatically.
To confirm support:
- Check the
FEDERATED TRACING
entry for your library on the supported subgraphs page. - If federated tracing isn't enabled automatically for your library, consult its documentation to learn how to enable it.
See the example below:
telemetry:apollo:errors:subgraph:all:# By default, subgraphs should report errors to GraphOSsend: true # (default: true)redact: false # (default: true)subgraphs:account: # Override the default behavior for the "account" subgraphsend: false