How-To Guide

How to Configure OpenTelemetry Collector Pipelines

Wire receivers, processors and exporters into collector pipelines for traces, metrics and logs, with batching, retries and back-pressure.

On this page

  1. Introduction
  2. The Pipeline Model
  3. Receivers and the OTLP Contract
  4. Processors: Batch, Memory Limit and Attribute Actions
  5. Exporters, Queues and Retries
  6. Splitting and Routing Data
  7. Scaling and Deployment Shape
  8. Common Pitfalls and Conclusion

Introduction

Applications emit telemetry, but they rarely emit it straight to every backend. The OpenTelemetry Collector is the middle tier that receives data from many sources, processes it, and exports it to one or more destinations. Its power and its confusion both come from the pipeline model: receivers turn inbound data into an internal format, processors transform or filter it, and exporters ship it onward. Getting the pipelines right means every service sends to one stable endpoint while you change backends, sample, redact and batch without redeploying the applications.

The Pipeline Model

A collector configuration has four top-level sections: receivers, processors, exporters and service. The service section wires them into pipelines, one per signal type. Traces go through an OTLP receiver, maybe a batch processor, and out through an OTLP or Jaeger exporter. Metrics and logs get their own pipelines, even when they share the same receivers and exporters.

The indirection is deliberate. Applications only need to know one endpoint. When you add a sampling processor, switch an exporter from one vendor to another, or fan out to two backends, the applications do not change. The collector becomes the place where observability policy lives, versioned and reviewed like any other configuration.

receivers:
  otlp:
    protocols:
      grpc: { endpoint: 0.0.0.0:4317 }
      http: { endpoint: 0.0.0.0:4318 }

processors:
  batch: {}
  memory_limiter:
    check_interval: 1s
    limit_mib: 400

exporters:
  otlphttp:
    endpoint: https://otlp.example.com
    retry_on_failure: { enabled: true }

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, batch]
      exporters: [otlphttp]

Receivers and the OTLP Contract

Prefer OTLP for everything. A single receiver type with gRPC and HTTP transports, on ports 4317 and 4318, means every SDK and every language ship to the same endpoint with the same semantics. Legacy receivers for Jaeger, Zipkin or Prometheus are useful for migration, but new instrumentation should speak OTLP so the collector stays simple and future backend changes stay invisible to applications.

Give the collector its own service endpoint behind a load balancer and treat the OTLP port as a public interface with monitoring. If the collector is down and has no queue, applications block or drop data; size the deployment for peak telemetry volume and monitor its own health, because it is now a dependency.

Processors: Batch, Memory Limit and Attribute Actions

The batch processor is almost always required. It groups spans, metrics or logs into bounded batches before export, which cuts the number of network calls and the overhead per record. The memory_limiter processor is equally important: telemetry can arrive faster than it leaves, and without a memory limit the collector grows until the kernel kills it, taking down observability precisely when you need it.

Attribute and resource processors let you add, rename, redact or drop fields centrally. This is where you remove a token from a URL, hash a user id for privacy, or attach a cluster name. Doing it in the collector means one place to audit and change policy, rather than every service.

processors:
  batch:
    send_batch_size: 512
    timeout: 5s
  memory_limiter:
    check_interval: 1s
    limit_mib: 800
    spike_limit_mib: 200
  attributes/scrub:
    actions:
      - key: http.url
        action: delete
      - key: user.email
        action: hash
  filter/drop_health:
    error_mode: ignore
    traces:
      span:
        - 'attributes["http.target"] == "/healthz"'

Exporters, Queues and Retries

Exporters send data to backends. Enable the sending queue so a brief backend outage does not drop data, and enable retries with backoff so transient errors recover automatically. These two settings convert a flaky network into a delay rather than a gap in your data, and they are the difference between an observability system you can trust and one you cannot.

Fan-out is easy: list two exporters on a pipeline and the collector replicates data to both. Use it to run a new backend in parallel with the old one during a migration, compare them, then decommission one. Watch the queue capacity, because if the durable queue fills, the collector starts dropping the oldest data.

exporters:
  otlp/primary:
    endpoint: primary-otlp.example.com:4317
    sending_queue:
      enabled: true
      num_consumers: 10
      queue_size: 5000
    retry_on_failure:
      enabled: true
      initial_interval: 1s
      max_elapsed_time: 300s
  otlp/shadow:
    endpoint: shadow-otlp.example.com:4317

Splitting and Routing Data

Not all telemetry belongs everywhere. You may want traces in one backend, logs in another, and expensive high-cardinality metrics only in a long-term store. Routing connectors and the filter processor let you split a pipeline by attribute: send production spans to the paid backend and drop debug spans, or route a tenant’s data to a separate destination for compliance.

Keep routing rules declarative and reviewed. A misrouted filter can silently discard the very data you need during an incident, so test routing with representative input before rolling it out, and monitor per-exporter counters to confirm data is arriving where you expect.

Scaling and Deployment Shape

A single collector instance is a single point of failure. Run it as a fleet behind a load balancer for stateless pipelines, and use a two-tier deployment when you need centralised processing: an agent tier near the applications and a gateway tier that batches and exports. The agent tier is cheap and horizontal; the gateway tier owns the heavy processors and the queues.

Size by memory, not CPU, because the collector is mostly buffering and serialising. Set the memory_limiter below the container limit and give the container headroom, so the limiter sheds load gracefully instead of the container being killed. Monitor the collector’s own telemetry, including dropped-record counters, because a collector that is silently dropping data looks healthy from the outside.

Common Pitfalls and Conclusion

Do not skip the memory limiter; unbounded collectors die under load. Do not disable the sending queue, or every backend blip becomes data loss. Do not run only one replica. Do not let routing filters silently drop data without a counter. And do not treat the collector configuration as untested code; validate changes in staging and roll them out with the same care as an application deploy.

The collector is the control plane for telemetry: receivers normalise input, processors enforce policy and protect memory, exporters deliver with queues and retries, and the service section wires it all together. Configure it once, in one place, and every application gets consistent, durable observability without knowing where the data goes.

Sources: OpenTelemetry Collector documentation, Collector configuration structure, OpenTelemetry Protocol (OTLP).

FAQ

Why put a collector between apps and the backend?
It decouples applications from backends. Apps send OTLP to one endpoint, and the collector handles batching, redaction, sampling, retries and fan-out. Changing a backend or adding policy becomes a collector config change instead of an application redeploy.
Which processors should every pipeline have?
At minimum a memory_limiter to avoid being killed under load and a batch processor to reduce export overhead. Add attribute or resource processors for redaction and enrichment, and enable the sending queue on exporters so short outages do not lose data.

Related Examples