Lesson 3 of 13 · 13m
The Collector Owns the Pipeline
OTLP receivers, memory_limiter-first pipelines, gateway routing by trace ID, and redaction as a pipeline stage.
Most services shouldn't decide where their telemetry goes. The OpenTelemetry Collector exists so that forty microservices can emit OTLP and one well-understood binary owns routing, batching, redaction, and sampling. The mental model to replace is "the SDK exports to my vendor." That couples every deploy to your backend choice, and it puts rate limits and secret-scrubbing in code you redeploy rather than config you reload.
The pipeline is the whole product
The collector config is three vocabularies wired together in service.pipelines:
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_percentage: 20
batch:
send_batch_size: 8192
timeout: 200ms
attributes:
actions:
- {key: enduser.id, action: delete}
- {key: http.request.header.authorization, action: delete}
exporters:
otlp:
endpoint: tempo.internal:4317
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, attributes, batch]
exporters: [otlp]Traces, metrics, and logs get separate pipelines — you can tail-sample traces while forwarding metrics untouched. A fourth vocabulary, connectors, sits between them: spanmetrics generates RED metrics (request rate, error rate, duration histograms) from the trace stream, and servicegraph builds dependency edges — both emit metrics into a metrics pipeline from inside the traces one.
memory_limiter goes first, always. A collector under burst load will happily grow its batch buffers until the OOM killer notices; the limiter checks on check_interval and rejects new data when limit_percentage (plus spike_percentage headroom for sudden bursts) is exceeded — a retryable error on OTLP, which pushes backpressure to clients that can resend, instead of dying with your buffered telemetry. batch after it amortizes per-request cost: exporters send send_batch_size-sized chunks every timeout interval instead of one connection per span flush, and send_batch_max_size caps the ceiling so a quiet trickle doesn't accumulate a giant payload. On the way out, the exporter's own retry_on_failure and sending_queue absorb backend hiccups.
Agent tier and gateway tier
The standard topology is two tiers. An agent collector per node — a DaemonSet on Kubernetes, a sidecar, a systemd unit — receives OTLP on localhost, tags the node identity (k8sattributes, resourcedetection), and forwards. A gateway tier does anything that needs a global view: tail sampling, cross-service aggregation, single-point export auth.
Tail sampling is the reason the gateway has to exist: a decision needs all spans of a trace on one instance. Random load balancing breaks that — span A lands on gateway 1, span B on gateway 2, and both wait out decision_wait for parts that never arrive. The fix is the loadbalancing exporter on the agent tier, which routes spans by routingKey: traceID so one trace always reaches one gateway.
Redaction is a pipeline stage, not a promise
Attributes like enduser.id, client.address, request headers, and url.full leak whatever your framework captured. Scrubbing at the SDK means auditing every service's instrumentation; scrubbing at the collector is one attributes or transform block applied uniformly. The transform processor's OTTL statements handle anything attributes can't express — regex-replacing a token embedded in a db.statement string, for instance. Do it centrally. Your compliance answer becomes one YAML file.
Practice
memory_limiterfirst in every pipeline;batchafter it; everything else is policy.- Route traces to the gateway tier with
loadbalancingkeyed ontraceIDwhenever tail sampling or cross-trace logic runs there. - Drop health-check noise with a
filterprocessor (/healthz,/metricsspans) before batching — it's cheaper than sampling them out later. - Keep secrets out of the config: exporters reference env vars like
${env:TEMPO_TOKEN}, andtls: {insecure: true}on an exporter is a dev posture, not a production one.
The collector is also your exit plan. When the observability vendor changes, you edit one exporter block — not forty deployments. Auth lives here too: exporters hold the API tokens (headers: {authorization: Bearer ${env:TEMPO_TOKEN}}), so rotating credentials is a config reload, not a fleet rollout.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Your Container Is Running SerialGC and Nobody Told You
You tuned G1 flags for a week. Your pod has one CPU, which means the JVM quietly picked a single-threaded collector at startup and ignored every flag you set. Here is the OpenJDK source that made that decision.
PostgreSQL 19 Is Out. REPACK Kept My Writes Running. The Docker Upgrade Will Stop Your App.
PostgreSQL 19 shipped on November 19 with REPACK (CONCURRENTLY), which removes table bloat without blocking writes. I measured it against VACUUM FULL, ran the upgrade from 18, and checked what breaks for self-hosters: Docker tags that refuse to start, a config setting that stops the server, and...
AWS Emulator Puts AWS on Your Laptop. Keep Your IAM Tests Off It.
AWS released AWS Emulator on November 11, a free local server that answers AWS API calls on 127.0.0.1 with per-run keys and fresh certificates.
Your npm Install Just Ran Someone Else's Code: Why Dependency Security Has to Start Before CI
A pull request checkout, a poisoned GitHub Actions cache, and an OIDC token pulled straight out of runner memory. That's how 84 malicious versions of TanStack's packages hit npm in six minutes.