Point an OpenTelemetry SDK at a vendor endpoint and you get telemetry flowing in an afternoon. You also get the vendor’s API key baked into every service’s config, retries controlled by someone else’s client library, no single place to sample or filter, and a migration project waiting for you the day you switch backends. The OpenTelemetry Collector exists to break that coupling: a standalone, vendor-neutral proxy that receives telemetry in a dozen formats, processes it, and ships it anywhere.
The Collector is one of those tools that looks like configuration soup until the mental model clicks. This post builds that model — the five component types, how pipelines wire them together, and which parts belong on a node-local agent versus a central gateway tier.
Five component types, one data path
Everything in a Collector is one of five things:
- Receivers get data in, either by listening (the
otlpreceiver exposes gRPC on 4317 and HTTP on 4318) or by scraping (prometheus,hostmetrics) or tailing (filelog). Receivers can also speak legacy protocols, which makes the Collector a drop-in replacement for old agents. - Processors transform data in flight:
memory_limiter,batch,filter,transform,k8sattributesfor Kubernetes metadata enrichment,tail_sampling. - Exporters send data out to one or more backends: OTLP over gRPC or HTTP, Prometheus remote write, Kafka, or
debugfor local development. - Connectors join two pipelines, acting as an exporter for the first and a receiver for the second — the
spanmetricsconnector, for instance, turns traces into RED metrics. - Extensions add capabilities outside the data path:
health_checkfor liveness probes,pprof, andfile_storagefor persistent retry queues.
As of this writing the core is at version 0.166, and the distribution most people should run is the contrib binary, which bundles the wide component set rather than the minimal core build.
Pipelines: where ordering actually matters
Components are wired into pipelines under the service key. Each pipeline is scoped to one signal — traces, metrics, or logs — and data flows strictly receivers → processors → exporters. One pipeline can fan in from several receivers and fan out to several exporters; each exporter receives a copy of every data element.
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: 75
spike_limit_percentage: 20
resource:
attributes:
- key: deployment.environment.name
value: production
action: upsert
batch:
send_batch_size: 8192
timeout: 5s
exporters:
otlphttp:
endpoint: https://otel-gateway.internal:4318
extensions:
health_check:
endpoint: 0.0.0.0:13133
file_storage:
directory: /var/lib/otelcol
service:
extensions: [health_check, file_storage]
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, resource, batch]
exporters: [otlphttp]
metrics:
receivers: [otlp]
processors: [memory_limiter, resource, batch]
exporters: [otlphttp]
Processors run in the order listed, and two positions are load-bearing. memory_limiter must be first in every pipeline: it’s the circuit breaker that sheds load before the process eats the node’s memory and gets OOM-killed. batch should be last: it buffers and groups data before export, amortizing network overhead, and batching after other processors keeps their work per-item rather than per-batch. A pipeline with batch before memory_limiter is a config review flag.
Reliability on the export side comes from the exporter’s own settings rather than the pipeline: sending_queue buffers data when a backend is unreachable (backed by the file_storage extension so the queue survives restarts), and retry_on_failure handles transient errors with exponential backoff.
Agent or gateway: what belongs where
There are two deployment shapes, and mature setups combine them.
An agent runs close to the workload — a DaemonSet in Kubernetes, a systemd service on VMs. Applications export to localhost, keeping the network hop short and failure isolated. The agent is the right home for anything host-local: tailing container logs with filelog, scraping node metrics, and Kubernetes metadata enrichment via k8sattributes, which needs to run near the workload to resolve pod identity reliably. If you later run a gateway tier, the agent applies k8sattributes first — after data leaves the node, those pod labels are gone.
A gateway is a centralized Collector Deployment that receives OTLP from agents or SDKs and owns everything cross-cutting: backend credentials in one place, cost controls like filtering and sampling applied uniformly, one place to change when you switch vendors. Gateway instances are stateless, so the tier scales horizontally behind any load balancer.
The agent tier keeps per-node work cheap and local; the gateway tier owns policy and egress. Small setups can collapse the two: applications exporting straight to a gateway-only Deployment is perfectly reasonable at modest scale.
The two-tier twist: tail sampling needs affinity
One scaling detail bites people who combine a gateway with tail sampling. Deciding a trace’s fate requires seeing all of its spans, but a load balancer distributing spans round-robin across gateway replicas scatters each trace across every instance, and each sampler votes blind. The fix is a two-tier setup: a first tier running the load-balancing exporter with routing_key: traceID, which hashes every span of a trace to the same second-tier replica; the second tier runs the tail sampling processor and can finally decide with full information.
The same affinity argument applies to the spanmetrics connector: route by service name (routing_key: service) when the aggregation must land on one instance to stay accurate.
Watch the watcher
A Collector is itself a service, and it will eventually be your incident. The internal telemetry docs describe how the Collector measures itself: the health_check extension doubles as a Kubernetes liveness endpoint, and internal metrics (export queue depth, accepted-vs-dropped spans, processor throughput) can be scraped with Prometheus like any other service. Dropped-batch counters climbing is the earliest signal that a backend is falling behind — catch it before the queue fills and data starts hitting the floor.
Start small if you’re adopting this incrementally: one contrib Collector as a gateway, SDKs pointed at it, the debug exporter locally while you build confidence in the config. Then add agents, then the pipeline processors that pay rent at your scale — enrichment first, sampling second, filtering last.