The OpenTelemetry Collector: One Pipeline for All Telemetry
Apps can send telemetry straight to a vendor, but most production setups put an OpenTelemetry Collector in between. It receives data from many sources, processes it and exports it to one or more backends.
Why use a Collector
- Apps only need to know one endpoint; switch or add backends without redeploying apps.
- Batching, retries and buffering when a backend is slow.
- Drop noisy data, remove sensitive attributes and add metadata (like Kubernetes pod names) centrally.
- Tail sampling: keep all error traces and a sample of the rest.
A configuration
receivers:
otlp:
protocols:
grpc: { endpoint: 0.0.0.0:4317 }
http: { endpoint: 0.0.0.0:4318 }
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
batch: {}
attributes/scrub:
actions:
- key: user.email
action: delete
exporters:
otlphttp/vendor:
endpoint: https://otlp.example-vendor.com
headers:
api-key: ${env:VENDOR_API_KEY}
debug: {}
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, attributes/scrub, batch]
exporters: [otlphttp/vendor]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp/vendor]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp/vendor]
Data flows receivers → processors → exporters, configured separately for each signal. Put memory_limiter first and batch last.
Deployment patterns
- Agent - a Collector on every node (a DaemonSet in Kubernetes), close to the apps. Good for adding host metadata and collecting node metrics and logs.
- Gateway - a central, scalable Collector deployment that agents forward to. Good for tail sampling and holding vendor credentials.
- Many setups use both.
Distributions
The "core" distribution has a small set of components; "contrib" includes many more receivers and exporters (Kafka, Prometheus scraping, cloud services). For production, consider building a custom distribution with only what you need.
Was this article helpful?
Comments
No comments yet. Have a question or a tip? Be the first to share it.