Course contents · Lesson 13 of 21

OTel Collector Pipelines: Receivers to Exporters

OpenTelemetry Collector and Jaeger · Lesson 13 of 21 · 11 min Hands-on

In the last lesson the lab's Collector started and Jaeger's page loaded, but you never saw a span pass through. When telemetry goes missing between an app and a backend, the first question is which route it took inside the Collector. OTel Collector pipelines are those routes. This lesson reads the lab's config, adds processors and a debug exporter, and fixes a Collector that will not start.

A pipeline is a named route for one signal

As the previous lesson showed, receivers take data in, processors change it and exporters send it out. A pipeline joins them into a route: one or more receivers, then processors in a fixed order, then one or more exporters.

Each pipeline has a type, traces, metrics or logs, and carries only that signal. Its name is the type, optionally followed by a slash and a label, such as traces/sampled, so one Collector can run two traces pipelines with different processors.

By the end of this lesson the lab runs the two pipelines below. Notice that both start at one receiver, and that the traces line forks at its end.

Railway map of the lab's Collector. Both pipelines start at one otlp receiver on ports 4317 and 4318. The traces line calls at memory_limiter (first), resource (adds the environment), attributes (drops user.email) and batch (last), then forks: one branch to the otlp_grpc/jaeger exporter, which sends to Jaeger on port 4317, the other to the debug exporter, which prints to the Collector's logs. Underneath, the metrics line calls at memory_limiter and batch and ends at the same debug exporter. Notes: one otlp receiver feeds both lines; both exporters get the processed spans.
One receiver feeds both lines, and the fork after the last processor sends the same spans to two places.

That otlp receiver is one listener on ports 4317 and 4318, handing traces to one pipeline and metrics to the other. A processor listed in two pipelines is not shared: the docs say each pipeline gets its own instance, so traces and metrics are never batched together.

Reading the config: definitions, then service

Open otel-collector/config.yaml in the lab folder. Four top-level sections, extensions, receivers, processors and exporters, define components and their settings. Defining a component does not start it: the docs say a component that is configured but not used in the service section is not enabled.

The fifth section, service, decides what runs. Its extensions list switches extensions on, and pipelines wires the other components into routes by name. Each name must match a key above, letter for letter. The annotated YAML shows the finished block; follow each arrow.

Annotated YAML in two panels. Left, defined: extensions with health_check, receivers with otlp, processors with memory_limiter, resource, attributes and batch, exporters with otlp_grpc/jaeger and debug. Right, wired in service: extensions list health_check; the traces pipeline lists receivers otlp, processors memory_limiter, resource, attributes, batch, and exporters otlp_grpc/jaeger and debug; the metrics pipeline lists otlp, memory_limiter and batch, and debug. Coloured arrows lead from each list to its section on the left. Notes: names must match a key above, processors run left to right, two exporters mean fan-out.
The top of the file is a parts list; only the names that service lists actually run.

Inside a pipeline, processors run in exactly the listed order. Extensions never appear there, because they serve the Collector itself, not the data.

Processors: memory_limiter first, batch last

No processor runs unless a pipeline lists it, and the order matters. The Collector's processor README recommends memory_limiter first, then processors that drop data, such as filters and samplers, then those that change or enrich it, and batch last. That way you never enrich or batch data you will throw away.

Here are the four processors the lab adds:

processors:
  memory_limiter:
    check_interval: 1s
    limit_mib: 400
    spike_limit_mib: 100
  resource:
    attributes:
      - key: deployment.environment.name
        value: lab
        action: upsert
  attributes:
    actions:
      - key: user.email
        action: delete
  batch: {}

memory_limiter keeps the Collector from running out of memory. Every check_interval it measures memory use. Above the soft limit, limit_mib minus spike_limit_mib (300 MiB here), it refuses new data with a temporary error, which tells a well-behaved sender to retry later. Above the hard limit, 400 MiB, it also forces a garbage collection, which frees memory nothing uses any more. In production, keep limit_mib below the container's own memory limit.

The next two edit attributes, the key-value pairs attached to telemetry. The resource is the set of attributes that describe what sent it, such as service.name. The resource processor's upsert adds deployment.environment.name with the value lab, or overwrites it if already set. The attributes processor edits each span's own attributes, here deleting user.email, personal data that should not leave the Collector.

Both READMEs now say these two are superseded by the transform processor, which uses statements such as delete_key(span.attributes, "user.email"). They still ship in contrib and fill many existing configs, so you will read them often.

The debug exporter and fan-out

The debug exporter writes telemetry into the Collector's own log, so docker compose logs shows what reaches the end of a pipeline. verbosity picks how much: basic, the default, prints one summary line per batch, normal about one line per span, and detailed every field, too much for a busy Collector.

Add it next to the Jaeger exporter, and change the service section to match:

exporters:
  debug:
    verbosity: detailed
  otlp_grpc/jaeger:
    endpoint: jaeger:4317
    tls:
      insecure: true
service:
  extensions: [health_check]
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, resource, attributes, batch]
      exporters: [otlp_grpc/jaeger, debug]
    metrics:
      receivers: [otlp]
      processors: [memory_limiter, batch]
      exporters: [debug]

Two names in one exporters list is fan-out: the pipeline hands the same processed data to each exporter. The Collector calls every exporter even when one fails, and the Jaeger exporter retries from its own queue, so debug output keeps flowing while Jaeger is down. The lab has no metrics backend, so the metrics pipeline ends at debug. The whole finished file is otel-collector/config.finished.yaml.

Restart, read the startup log, fix the name

The Collector reads its config only when it starts, so every edit follows the loop in the flowchart. Notice the decision after the logs: a bad config stops the Collector before it opens any port, and the error says what to fix.

Flowchart. 1: edit config.yaml in the otel-collector folder. 2: docker compose restart otel-collector. 3: docker compose logs -f otel-collector. Decision: startup error? Yes: fix the quoted name, for example debg to debug, and try again from step 1. No, Everything is ready: 4: send a test span with bash send-test-span.sh, which prints HTTP 200. 5: read the debug output, a Traces line with spans: 1 and then the span's fields. 6: find the same span in Jaeger at localhost:16686, the fan-out's other branch. Note: the Collector reads its config only when it starts, so every edit needs step 2.
A broken config never half-starts: you get either an error that names the problem or a running pipeline you can test.

Follow the log with docker compose logs -f otel-collector; -f keeps printing new lines until you press Ctrl+C. A good start includes a Memory limiter configured line with your limits and ends with Everything is ready. Begin running and processing data.

A misspelt name stops the start instead, and Docker restarts the container again and again. Look for the line that begins with Error:. A typo in a pipeline's list, such as debg, names the pipeline and the missing component:

Error: invalid configuration: service::pipelines::traces: references exporter "debg" which is not configured

A typo in the definition fails earlier, because no component type has that name. That error begins Error: failed to get config: and goes on to 'exporters' unknown type: "debg" for id: "debg", followed by the list of valid types.

To check a file without touching the running Collector, run docker compose run --rm otel-collector validate --config=/etc/otelcol-contrib/config.yaml in a throwaway container. It prints nothing when the file is valid and an Error: line when it is not.

Check yourself

A teammate writes processors: [batch, filter], where filter drops health-check spans. Those spans still never reach Jaeger. What is wrong with this order?

It works but wastes effort: batch first collects and holds spans that filter then throws away. Put filter after memory_limiter and before batch, so only the spans you keep are batched.

Jaeger is down for two minutes while spans keep arriving. Does the debug exporter keep printing them?

Yes. Fan-out hands the same spans to both exporters, and the Collector calls each one even when another fails. The Jaeger exporter's batches wait in its own queue for a retry, so its trouble does not hold back debug.

You define debug: under exporters and restart. The Collector starts without errors, but a test span prints no Traces line. What did you most likely forget?

To add debug to a pipeline's exporters list. A component that is defined but not used in service is never enabled, and that is not an error, so the start looks clean.

Go deeper