ObservabilityIntermediate

Observability Pipelines: Collectors, Processors, Routing

DeveloperHat Team
17 min read

TL;DR

Your SDKs are the easy part. The pipeline — collectors, processors, routing, fan-out — is what you actually operate. How to build one that survives real traffic.

Instrumenting a service is a solved problem. Add the SDK, set an endpoint, and spans start flowing — OpenTelemetry graduated at the CNCF in May 2026, and the instrumentation side of it is now as boring as DNS. The part nobody budgets for is what happens between the SDK and the backend: the pipeline that receives, processes, samples, redacts, routes, and exports every span, metric, and log your fleet produces. That pipeline is a data plane you now operate, and it fails in ways a library never does — it runs out of memory, it drops data silently, it becomes the single point where a bad config takes down observability for every service at once.

The short version: put a Collector between your services and your backends, run it in two tiers (a dumb agent per node, a smart gateway in the middle), put memory_limiter first in every pipeline, decide sampling at the gateway where the whole trace is visible, derive your RED metrics from traces before sampling, and fan out to one pipeline per destination so a dead backend cannot block the others. The rest of this guide is the evidence behind those sentences — and the cases where each of them is wrong.

From SDK to backend: two tiers, one choke point Apps talk to a local agent; the gateway decides what leaves the cluster. checkout API OTLP · traces worker OTLP · logs web OTLP · metrics Agent Collector DaemonSet · per node Gateway sample · filter · route Hot Tempo · Loki Archive S3 · vendor The agent tier is cheap and dumb; the gateway is where policy lives — and where an outage hurts.

The pipeline model: four component types, three signals

The OpenTelemetry Collector is a vendor-neutral service that receives telemetry, processes it, and exports it to one or more backends. It is a single binary, deployable as an agent next to your services or as a standalone gateway, and it handles traces, metrics, and logs through the same model. Everything in a Collector configuration is one of four component types, plus extensions:

  • Receivers collect telemetry from one or more sources. They can be push-based (the OTLP receiver listening on gRPC port 4317 and HTTP port 4318) or pull-based (the Prometheus receiver scraping targets, the hostmetrics receiver reading the OS).
  • Processors modify or transform data between receiving and exporting — filtering, dropping, renaming, enriching, sampling. They run in the order you list them, and that order is load-bearing.
  • Exporters send data to backends. One exporter per destination, each with its own endpoint, credentials, retry policy, and queue.
  • Connectors join pipelines: one pipeline's output becomes another's input. The classic example is spanmetrics, which consumes traces and emits RED metrics — the reason your dashboards keep working after sampling throws 90% of traces away.
  • Extensions add capabilities that do not touch telemetry directly, such as the health_check endpoint and pprof profiling.
  • Components are wired together in the service section, in one pipeline per signal:

    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: 0.0.0.0:4317
          http:
            endpoint: 0.0.0.0:4318
    processors:
      memory_limiter:
        check_interval: 1s
        limit_mib: 512
    exporters:
      otlp_grpc:
        endpoint: backend:4317
    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: [memory_limiter]
          exporters: [otlp_grpc]

    Two details in that small example carry most of the operational weight. First, defining a component does not enable it — a receiver, processor, or exporter only runs when it appears in a pipeline in the service section. A perfectly configured tail-sampling processor that is not listed in any pipeline silently does nothing, and nothing in the logs will tell you. Second, the Collector ships with a validate command — otelcol validate --config=config.yaml — which belongs in CI, in front of every config change, because a typo in a pipeline name fails the whole Collector at startup, not just the broken pipeline.

    Configuration can come from files, environment variables, inline YAML, or HTTP(S) endpoints, and multiple --config files merge into one in-memory configuration. That merge is the mechanism pipeline-as-code is built on: a base file owned by the platform team, per-team overlays, and one validated artifact per environment. The configuration docs are the primary source for the full model, and they are worth reading before writing a single pipeline.

    The pipeline is four layers — the middle two are where it breaks Sources — SDKs · Prometheus scrape · log shippers · eBPF Receivers — OTLP 4317 / 4318 · Prometheus · Kafka · hostmetrics Processors — memory_limiter first · filter · transform · sampling Routing & export — one pipeline per signal · fan-out to backends Receivers and exporters are boring by design. The processors and the routing are the decisions.

    The four topologies, and which one you actually need

    Every Collector deployment is one of four shapes. The differences are where policy lives and what breaks when a tier dies.

    TopologyWhat it isGood forWhat it costs you
    Direct to backendSDKs export straight to Tempo, a vendor, or PrometheusDevelopment, a single service, proving instrumentation worksNo batching, no retries, no redaction, no sampling; every service holds backend credentials
    Agent tier onlyA Collector per node (DaemonSet) or per host; services export to localhostOne cluster, one team, steady volumeYou operate a fleet of agents; policy is duplicated across nodes
    Agent + gatewayAgents forward to a central gateway tier that samples, filters, and routesMany teams, regulated data, more than one backendA new component to page for; added latency; the gateway is a choke point
    Two-tier with load balancingA first tier hashes trace IDs to a second tier that runs tail samplingTail sampling at real volumeStateful routing; all spans of a trace must land on the same second-tier instance

    Direct to backend is where the Collector's own documentation tells you to start: for trying things out and for small-scale environments, sending data directly to a backend gets value quickly. Stay there until a real constraint appears — volume that needs batching, data that must be redacted before it leaves the cluster, a second backend, or a bill that needs sampling. A pipeline you do not need is a pipeline you page for at 3 AM.

    Agent tier only is the default production shape. The agent takes work off the application — retries, batching, encryption, sensitive-data filtering — and a failure is contained to one node. Services export to localhost, so they never hold backend credentials and never block on a slow backend. The agent is deliberately dumb: batch, enrich with node metadata, forward. Policy that differs per team does not belong here, because it would have to be duplicated on every node.

    Agent + gateway is where policy lives. The gateway is the one place that sees all of a team's traffic, so it is the only place tail sampling, central redaction, and routing decisions can happen. It centralises credentials and filtering at the cost of another component to maintain, some added latency, and more resources. The gateway is also the choke point: if it goes down, telemetry stops for everything behind it, which is why it gets its own replicas, its own alerts, and a tested runbook before it gets a second feature.

    Two-tier with load balancing exists for exactly one reason: tail sampling needs every span of a trace on the same Collector instance. The first tier runs the load_balancing exporter, which hashes the trace ID and forwards each trace to one second-tier instance; the second tier, usually a StatefulSet behind a headless Service, buffers traces and applies the sampling policy. Without that tier, tail sampling silently produces partial traces — the sampler keeps the spans it saw and drops the ones routed elsewhere. If you are not running tail sampling, you do not need this topology.

    Processors, in the order that matters

    Processors run in listed order, and the order is the design. A pipeline that samples before it redacts ships PII to the backend in the 10% it keeps. A pipeline that batches before it limits memory OOMs under a burst. The canonical order, and the reason for each position:

    1. memory_limiter, first, always. It is the only processor whose job is to keep the Collector alive. Set limit_mib below the container's memory limit with room for spikes (spike_limit_mib), and set GOMEMLIMIT on the process as well — the documentation recommends both. When the limit is hit, the Collector sheds load by refusing data rather than dying; refused data is lost, but a dead Collector loses everything, including the data already buffered.

    2. batch — or its replacement. Batches are now built in the exporter itself, through sending_queue with a batch: {} block. The project has also released a queue_batch processor that replaces the legacy batch processor; it is in beta and not yet included in the official distributions, so check which distribution you run before reaching for it. Either way, batching is what turns a stream of single spans into efficient export calls — without it, you pay a request per span.

    3. filter and transform: drop and redact before anything else sees the data. The filter processor drops whole signals by OTTL expression — debug logs below a severity, health-check spans, the /metrics scrape path. The transform processor rewrites what remains: delete db.statement before it leaves the cluster, hash an email attribute instead of dropping the span that carries it, rename a legacy attribute to the current semantic convention. Redaction belongs in the pipeline, not in the application, because the pipeline is the last place data passes before a vendor's retention policy applies to it.

    4. attributes and resource: enrich. Add the environment, the cluster name, the Kubernetes namespace and pod — the labels every dashboard and alert will group by. Enrichment at the Collector beats enrichment in the SDK because it is one config change instead of a release per service, and because a missing attribute is a pipeline bug you can fix in minutes.

    5. Samplers: head-style in the Collector, tail at the gateway. The probabilistic_sampler processor hashes the trace ID and keeps a percentage — the Collector-side version of head sampling, useful when a tier of Collectors must agree on which traces to keep. Every Collector in the tier needs the same hash_seed, or each makes a different decision for the same trace. The tail_sampling processor, covered in detail in our OpenTelemetry sampling guide, buffers each trace until it is complete and then keeps it if a policy matches — any span errored, latency over a threshold, a route worth keeping — plus a small random baseline. It lives in the contrib distribution, is beta for traces, and its defaults are a 30-second decision_wait and 50,000 traces held in memory per instance. Those defaults are a memory budget: raise either number and you are buying trace completeness with RAM.

    Here is a gateway traces pipeline that puts the order together — memory protection, redaction, tail sampling, one exporter:

    # Gateway tier — traces pipeline, Collector 0.165 (November 2026)
    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: 0.0.0.0:4317
          http:
            endpoint: 0.0.0.0:4318
    processors:
      memory_limiter:
        check_interval: 1s
        limit_mib: 2000
        spike_limit_mib: 500
      transform/redact:
        error_mode: ignore
        trace_statements:
          - delete_key(span.attributes, "db.statement")
          - delete_key(span.attributes, "http.request.header.authorization")
      tail_sampling:
        decision_wait: 10s
        num_traces: 100000
        policies:
          - name: keep-errors
            type: status_code
            status_code:
              status_codes: [ERROR]
          - name: keep-slow
            type: latency
            latency:
              threshold_ms: 2000
          - name: baseline-10pct
            type: probabilistic
            probabilistic:
              sampling_percentage: 10
    exporters:
      otlp_grpc/traces:
        endpoint: tempo:4317
        sending_queue:
          batch: {}
    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: [memory_limiter, transform/redact, tail_sampling]
          exporters: [otlp_grpc/traces]

    Note what is not in this pipeline: a metrics pipeline and a logs pipeline. Those are separate pipelines in the same file, with their own processors — metrics get cardinality control, logs get severity filtering — and they share the receiver. One file, three pipelines, one process. That is the whole model.

    Routing and fan-out: one pipeline per destination

    The Collector's most underused feature is that a pipeline can have several exporters, and a configuration can have several pipelines for the same signal. That is how routing works, and it is how you stop one backend's outage from becoming an observability outage.

    Hot vs archive. Traces go to Tempo for querying and to cheap object storage for compliance retention — two exporters on the same traces pipeline, or two pipelines with different sampling (keep everything for 24 hours in the hot store, keep 1% for 90 days in the archive). The same pattern applies to logs: errors to Loki, everything to S3.

    Per-team routing. A routing connector sends telemetry to different backends based on an attribute — team: payments to the payments team's Tempo, everything else to the shared one. It is the mechanism that lets one gateway serve teams with different retention and cost rules without running a gateway per team.

    Span metrics before sampling. The spanmetrics connector consumes the traces pipeline and emits request rate, error rate, and latency histograms — the RED metrics your alerts and SLOs run on. Because it sits before the tail-sampling processor in the pipeline order, the metrics describe all traffic, not just the 10% of traces you kept. Sampling then cannot blind your dashboards: the traces you threw away still counted. Our SLO and error budget guide covers what to do with those metrics once they exist.

    One pipeline per destination, not one pipeline with five exporters. When an exporter blocks — a backend is down, its queue is full — it applies backpressure to the pipeline it belongs to. Five exporters in one pipeline means one dead vendor stalls the other four. Separate pipelines per destination isolate the failure: the vendor pipeline backs up and sheds load, the Tempo pipeline keeps flowing. The cost is a longer config file, which is the cheapest kind of cost in this system.

    Pick the topology by scale, not by fashion How much telemetry? volume · teams · regulation Dev / one service low volume One cluster, one team steady volume Many teams / regulated PII · sampling Direct to backend no Collector yet Agent tier only DaemonSet per node Agent + gateway policy in one place Add a tier only when a real constraint demands it — each tier is a new thing to page for.

    Architecture Decision

    Decision: Run the Collector in two tiers — a dumb agent per node and a smart gateway — with tail sampling and redaction at the gateway, RED metrics derived from traces before sampling, and one pipeline per destination so a dead backend cannot block the others.

    Context: The team instruments with the OpenTelemetry SDKs and exports directly to a vendor backend. The bill grows with volume, PII occasionally appears in span attributes, and when the vendor has an outage, services block on export and observability goes dark at the same time as the system under investigation. The sampling discussion keeps circling because no one can agree where the decision should live.

    Options considered: (1) The two-tier pipeline above. (2) Direct-to-backend everywhere — zero new components, but no sampling, no redaction, no retries, and credentials in every service. (3) Agent tier only — fixes retries and credentials, but sampling and redaction stay duplicated per node and tail sampling is impossible, because no single agent sees a whole trace. (4) A vendor agent instead of the Collector — less to operate, but the pipeline becomes the vendor's, and switching backends means re-instrumenting.

    Why this one: The gateway is the only place with the whole picture — the whole trace for tail sampling, all teams' traffic for routing, one place to redact before data leaves the cluster. The agent tier keeps the failure domain small and the services decoupled from backends. Deriving RED metrics before sampling removes the sampling debate from the alerting path entirely: dashboards stay correct whatever the sampling policy does. And one pipeline per destination is the only option in which a vendor outage is a vendor problem, not an observability outage.

    What it costs you: A data plane to operate — the gateway needs replicas, its own dashboards, its own alerts, and a runbook, because it is now load-bearing infrastructure. Tail sampling costs memory by design (50,000 traces buffered by default, more if you raise it), and the two-tier load-balancing setup costs a stateful routing layer. The config is also a real codebase now: versioned, validated in CI, and reviewed like application code, which is a process cost some teams resent until the first bad config takes down telemetry for an hour.

    When to reverse it: When there is one team, one backend, and low volume — collapse to the agent tier, or even direct export, and spend the operational budget elsewhere. Reverse toward a vendor agent when the team cannot staff the gateway's on-call: a pipeline nobody owns is worse than a vendor's pipeline, because at least the vendor answers the page. And reverse the tail-sampling tier specifically if the memory cost ever exceeds the debugging value of the traces it saves — head sampling plus span metrics is a legitimate, cheaper steady state.

    Pipeline-as-code: the config is a deployment

    The pipeline configuration is infrastructure, and it deserves the same discipline. Keep it in Git. Run otelcol validate in CI on every change. Pin the Collector distribution version in the image tag, and read the release notes before upgrading, because component names move: since 0.144 the otlp exporter is otlp_grpc and otlphttp is otlp_http, with the old names kept only as deprecated aliases, and the 0.152/0.153 releases renamed a wave of components to snake_case — loadbalancing became load_balancing, resourcedetection became resource_detection. An unpinned upgrade that renames a component in your config fails the Collector at startup, which is exactly the failure validate in CI exists to catch.

    Deploy the Collector the way the project expects it to be deployed: the Helm chart or the OpenTelemetry Operator for Kubernetes, a DaemonSet for agents, a Deployment or StatefulSet for the gateway tier. Roll config changes like code changes — canary the gateway, watch its own metrics, then roll the rest. Never hand-edit a running Collector's config and hope; the config is the system, and an unreviewed edit to it is an unreviewed change to every service's observability.

    Operating the pipe: monitor the monitor

    A Collector that nobody watches is a silent data-loss machine. The Collector exposes its own telemetry on the same model it serves: a Prometheus endpoint (port 8888 by default) scraping its internal metrics, a health_check extension (port 13133), and pprof (port 1777) for when it misbehaves. Watch three things: queue depth per exporter (a growing queue is a backend problem arriving early), memory against the memory_limiter threshold (sustained shedding means the pipeline is undersized, not that the limiter is working), and dropped spans per pipeline (the number that tells you whether sampling is a policy or an accident).

    Three failure modes account for most pipeline incidents. Cardinality explosion — an unbounded attribute (a user ID, a request path with an ID in it) in a metric label creates a series per value; the fix is a transform rule that drops or hashes the attribute, applied at the gateway before the metrics pipeline. Tail-sampling memory — num_traces times decision_wait times average trace size is a real number; size the gateway's memory from it, do not discover it. One bad exporter — covered above: separate pipelines per destination, and alert on per-exporter queue depth, not on the Collector as a whole. Our Kubernetes monitoring guide covers where the probes go, and our incident management guide covers what happens after the page — the pipeline deserves a blameless postmortem like any other production system, because it is one.

    When NOT to build a pipeline

    Do not build this for a development environment, a single service, or a team of three with one backend. Export directly, as the Collector's own documentation recommends for getting started, and spend the effort on instrumentation quality instead — good span names, consistent attributes, and a sampling policy are worth more than a gateway at that scale. Do not build the two-tier tail-sampling setup unless you have traces worth keeping conditionally: if every trace is equally uninteresting, head sampling at 10% plus span metrics is the whole answer. And do not build a gateway you cannot staff. The honest test is whether someone owns the pipeline's on-call; if the answer is "whoever notices it is down", you do not have a pipeline, you have a future incident.

    The honest summary is that the pipeline is not plumbing. It is the place where cost, privacy, and debuggability are decided for everything your services emit — the sampling policy that determines whether the error that matters is kept, the redaction rule that determines whether PII reaches a vendor, the routing that determines whether a backend outage is visible. Instrumentation is the easy part. The pipeline is the system. Build it deliberately, operate it like production, and re-check it every time the volume doubles — the topology that was right at one tier is wrong at the next, and the config will tell you which one you have if you read it.

    Why This Matters

    Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.

    Trade-offs to Consider

    Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.

    When NOT to Use This

    Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.

    Decision Framework

    Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.

    Share this articleShare on XShare on LinkedIn

    Keep the decision frameworks coming

    One practical architecture guide a week — patterns, trade-offs, and when not to use them. No spam, unsubscribe anytime.