Join us from October 8-10 in New York City to learn the latest tips, trends, and news about GraphQL federation and API platform engineering.Join us for GraphQL Summit 2024 in NYC
Docs
Start for Free

OpenTelemetry Protocol (OTLP) exporter

Configure the OpenTelemetry Protocol exporter for tracing


Enable and configure the OpenTelemetry Protocol (OTLP) exporter for tracing in the .

OTLP is the native protocol for OpenTelemetry. It can be used to export traces over HTTP or gRPC to a variety of backends including:

For general tracing configuration, refer to Router Tracing Configuration.

OTLP configuration

The Apollo Router can be configured to export tracing data using OTLP either via HTTP or gRPC:

router.yaml
telemetry:
exporters:
tracing:
otlp:
enabled: true
# Optional endpoint, either 'default' or a URL (Defaults to http://127.0.0.1:4317 for gRPC and http://127.0.0.1:4318 for HTTP)
endpoint: default
# Optional protocol (Defaults to grpc)
protocol: grpc
# Optional Grpc configuration
grpc:
metadata:
"my-header": "value1"
# Optional Http configuration
http:
headers:
"my-header": "value1"

enabled

Set to true to enable the OTLP exporter. Defaults to false.

endpoint

The OTLP endpoint.

Defaults to:

NOTE

Specify only the base URL in the endpoint parameter. The automatically adds the /v1/traces portion of the URL to match the OpenTelemetry specification.

grpc

Settings specific to the gRPC protocol for setting a custom SSL certificate, domain name, and metadata.

telemetry:
exporters:
tracing:
otlp:
grpc:
domain_name: "<my-domain>"
key: "<key>"
ca: "<certificate-authority>"
cert: "<certificate>"
metadata:
key1: value1
key2: value2

💡 TIP

Use the variable expansion feature for referencing environment variables and file paths in YAML configuration files. Use env. and file. prefixes, for example ${file.ca.txt}.

gRPC configuration reference

AttributeDescription
domain_nameAn optional domain name.
keyAn optional key.
caAn optional certificate authority.
certAn optional certificate.
metadataA map of headers to send with requests

http

Settings specific to the HTTP protocol for setting custom headers.

http:
headers:
key1: value1
key2: value2

HTTP configuration reference

AttributeDescription
headersA map of headers to send with requests

batch_processor

All exporters support configuration of a batch span processor with batch_processor.

You must tune your batch_processor configuration if you see any of the following messages in your logs:

  • OpenTelemetry trace error occurred: cannot send span to the batch span processor because the channel is full

  • OpenTelemetry metrics error occurred: cannot send span to the batch span processor because the channel is full

The exact settings depend on the bandwidth available for you to send data to your application peformance monitor (APM) and the bandwidth configuration of your APM. Expect to tune these settings over time as your application changes.

An example configuration using OTLP with batch_processor:

telemetry:
exporters:
tracing:
otlp:
batch_processor:
max_export_batch_size: 512
max_concurrent_exports: 1
max_export_timeout: 30s
max_queue_size: 2048
scheduled_delay: 5s

batch_processor configuration reference

AttributeDefaultDescription
scheduled_delay5sThe delay in seconds from receiving the first span to sending the batch.
max_concurrent_exports1The maximum number of overlapping export requests.
max_export_batch_size512The number of spans to include in a batch. May be limited by maximum message size limits.
max_export_timeout30sThe timeout in seconds for sending spans before dropping the data.
max_queue_size5The maximum number of spans to be buffered before dropping span data.

OTLP configuration reference

AttributeValuesDefaultDescription
enabledfalseEnable the OTLP exporter.
protocolgrpc|httpgrpcThe protocol to use.
endpointhttp://127.0.0.1:4317 for gRPC and http://127.0.0.1:4318 for HTTPThe endpoint to send spans to.
grpcConfiguration specific to gRPC protocol.
httpConfiguration specific to HTTP protocol.
temporarilityThis configuration option is unused for tracing.
batch_processorThe batch processor settings.
Previous
New Relic
Next
Zipkin
Rate articleRateEdit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company