Sending Apollo Router usage data to Apollo Studio
The Apollo Router can transmit usage data to Apollo Studio via a reporting agent called Spaceport.
Enabling usage reporting
You can 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>
More information on usage reporting is available in the Studio documentation.
Enabling field-level instrumentation
Apollo field-level instrumentation (also known as FTV1 tracing) is set to a sampling rate of 0.01
by default, which means it will request traces for 1% of traffic. To change it to a higher rate, set the field_level_instrumentation_sampler
value to a rate higher than 0.1
. To completely disable it, set it to always_off
.
Note
Since field-level instrumentation is dependent OpenTelemetry tracing, it is necessary to set the sampler
value for traces to a value the same or higher than the field_level_instrumentation_sampler
value.
The following example sets both Apollo field-level tracing and OpenTelemetry tracing to attempt to sample 50% of requests:
telemetry:apollo:# This example will trace half of requests. This number can't# be higher than tracing.trace_config.sampler.field_level_instrumentation_sampler: 0.5tracing:trace_config:# FTV1 uses the same trace sampling as other tracing options,# so this value must be set as well.sampler: 0.5
Note that field_level_instrumentation_sampler
may not sample at a greater rate than trace_config.sampler
.
Advanced configuration
send_headers
Provide this field to configure which request header names and values are included in trace data that's sent to Apollo Studio. Valid options are: only
with an array, except
with an array, none
, all
.
The default value is none
, which means no header names or values are sent to Studio. This is a security measure to prevent sensitive data from leaving your infrastructure unless you specifically opt into it
send_variable_values
Provide this field to configure which variable values are included in trace data that's sent to Apollo Studio. Valid options are: only
with an array, except
with an array, none
, all
.
The default value is none
, which means no variable values are sent to Studio. This is a security measure to prevent sensitive data from leaving your infrastructure unless you specifically opt into it.
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->trace_config->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:trace_config:sampler: 0.5 # The percentage of requests that will generate traces (a rate or `always_on` or `always_off`)