The OpenTelemetry Collector is an intermediary between your applications and your observability backends. Instead of sending your traces directly to Jaeger, your metrics to Prometheus and your logs to Loki, your applications send everything to the Collector over OTLP, and it takes care of distributing the data to the right places.
This lesson follows the previous one, which made applications emit telemetry. The configurations target 0.155.0, the version pinned in the commands.
What you will learn
- Explain the role of the Collector and the path of a piece of data: receivers, processors, exporters
- Install the Collector with Docker, Helm or the binary, at a pinned version
- Build a first pipeline that sends traces to Jaeger, and check that a trace arrives
- Connect an application by choosing the right OTLP port and protocol
- Write a full pipeline for traces, metrics and logs
- Troubleshoot the most frequent pipeline failures
What is the Collector for?
The Collector decouples your applications' code from your infrastructure choices: the application speaks a single protocol, and routing to the backends becomes a matter of configuration.
The problem without a Collector
Picture a Python application that has to send traces to Jaeger, metrics to Prometheus and logs to Loki. Without a Collector, each backend imposes its own SDK, format and configuration:
# Each backend has its own SDK, format, configfrom jaeger_client import Config as JaegerConfigfrom prometheus_client import start_http_serverimport logging_loki
# 3 different connections, 3 different formatsjaeger_tracer = JaegerConfig(...).initialize_tracer()start_http_server(8000) # Prometheus endpointloki_handler = logging_loki.LokiHandler(url="http://loki:3100/...")Three drawbacks follow, and they grow with the number of services:
- If you change the traces backend (Jaeger → Tempo), you change the code
- Each service has its own connection config
- No filtering, no data transformation
The solution: the Collector as an intermediary
With the Collector, your applications send everything to the same place, and the diagram below reads from left to right: each piece of data goes through a receiver, processors, then an exporter towards its backend.
The benefits read as a point-by-point answer to the previous drawbacks:
- Simpler code: your app only knows OTLP, not the backends
- Backend change: modify the Collector config, not the code
- Transformation: filter, enrich, sample the data before sending
- Resilience: the Collector buffers if a backend is temporarily unavailable
Understanding the architecture
The Collector works as a three-stage pipeline, declared in a single YAML
file: receivers receive, processors transform, exporters send. The
service section then assembles these building blocks into pipelines, one per
signal.
1. Receivers: receiving the data
Receivers listen on ports and ingest incoming data. For a new
application, otlp is enough; the others serve to integrate existing tools.
| Receiver | What it receives | Default port |
|---|---|---|
otlp | Traces, metrics, logs in OpenTelemetry format | 4317 (gRPC), 4318 (HTTP) |
jaeger | Traces in Jaeger format | 14268 |
prometheus | Metrics scraped from endpoints | - |
filelog | Logs from files | - |
2. Processors: transforming the data
Processors modify the data between reception and sending. Two of them
belong in every pipeline, in this order: memory_limiter first, to protect
the Collector, then batch.
| Processor | What it does | When to use it |
|---|---|---|
batch | Groups data (reduces network traffic) | Always |
memory_limiter | Prevents OOMs by limiting memory | Always |
filter | Drops useless data | Reduce costs |
attributes | Adds/removes metadata | Enrich or mask sensitive data |
k8sattributes | Adds Kubernetes metadata (pod, namespace…) | On Kubernetes |
3. Exporters: sending to the backends
Exporters pass the data on to the final backends. Their names have changed:
on 0.155.0, the old otlp and prometheusremotewrite aliases still work
but produce a warning at startup, and the loki exporter has disappeared,
rejected with unknown type: "loki". The table gives the current names.
| Exporter | Destination | When to use it |
|---|---|---|
otlp_grpc | Any OTLP-compatible backend over gRPC (Tempo, Jaeger…) | Traces and metrics |
otlp_http | OTLP backend over HTTP, including Loki 3 on its /otlp endpoint | Logs to Loki, or if gRPC is blocked |
prometheus_remote_write | Prometheus, Mimir, Cortex | Metrics |
debug | Console (stdout) | Troubleshooting |
Installing the Collector
Three installation modes, for three contexts: Docker to try it out on a workstation, Helm for a Kubernetes cluster, the binary for a machine without containers. The YAML configuration is the same in all three cases.
-
Create a configuration file
config.yaml receivers:otlp:protocols:grpc:endpoint: 0.0.0.0:4317http:endpoint: 0.0.0.0:4318processors:memory_limiter:check_interval: 1slimit_mib: 512spike_limit_mib: 128batch:timeout: 5sexporters:debug:verbosity: detailedextensions:health_check:endpoint: 0.0.0.0:13133zpages:endpoint: 0.0.0.0:55679service:extensions: [health_check, zpages]pipelines:traces:receivers: [otlp]processors: [memory_limiter, batch]exporters: [debug]This minimal config:
- Listens for OTLP on ports 4317 (gRPC) and 4318 (HTTP)
- Limits memory (
memory_limiter) to avoid OOMs - Groups data in 5-second batches
- Enables
health_check(port 13133) andzpages(port 55679) for diagnostics - Prints traces to the console (to check that it works)
-
Run the Collector
Terminal window docker run -d \--name otel-collector \-p 127.0.0.1:4317:4317 \-p 127.0.0.1:4318:4318 \-p 127.0.0.1:13133:13133 \-v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml:ro \otel/opentelemetry-collector-contrib:0.155.0@sha256:4935caa35e9a4cb387e35732e8fb22b2b5759af8d12e7043357f03837f6e8df5The image is pinned by its tag and its digest: the tag alone can be moved, and
:latestwould introduce incompatible changes without warning.Why contrib? There are two images:
opentelemetry-collector(core) andopentelemetry-collector-contrib. Use contrib: it includes the community receivers and exporters you will need, such asprometheus_remote_write. -
Check that it works
Terminal window # Check the logsdocker logs otel-collector# Check the health checkcurl http://localhost:13133/What you should see (real output from 0.155.0, shortened):
info service@v0.155.0/service.go:256 Starting otelcol-contrib...info service@v0.155.0/service.go:279 Everything is ready. Begin running and processing data.The health check returns:
{"status":"Server available","upSince":"2026-10-08T03:56:34.69088127Z","uptime":"4.970807372s"}If you see
Everything is readyand the health check passes, the Collector is operational.
-
Add the Helm repo
Terminal window helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-chartshelm repo update -
Create a values.yaml file
values.yaml mode: deployment # or daemonset to collect per nodefullnameOverride: otel-collectorimage:repository: otel/opentelemetry-collector-contribtag: "0.155.0"digest: sha256:4935caa35e9a4cb387e35732e8fb22b2b5759af8d12e7043357f03837f6e8df5config:receivers:otlp:protocols:grpc:endpoint: 0.0.0.0:4317http:endpoint: 0.0.0.0:4318processors:batch:timeout: 5smemory_limiter:check_interval: 1slimit_mib: 512exporters:debug:verbosity: detailedservice:pipelines:traces:receivers: [otlp]processors: [memory_limiter, batch]exporters: [debug]fullnameOverridesets the Service name tootel-collector. Without it, the chart names the Service<release>-opentelemetry-collector, that isotel-collector-opentelemetry-collectorfor this release, and theotel-collector.observability.svcaddress used further down does not resolve.The
imageblock is mandatory: the chart picks no default image, andhelm installstops with'image.repository' must be setif it is missing. It reuses the contrib image from the Docker tab. Whendigestis set, the chart pulls the image by its digest and ignores the tag. With the core imageotel/opentelemetry-collector, you would also need to setcommand.name: otelcol. -
Install
The chart version is pinned: chart 0.164.1 ships Collector 0.155.0, the version used on this page.
Terminal window helm install otel-collector open-telemetry/opentelemetry-collector \--version 0.164.1 \--namespace observability \--create-namespace \-f values.yaml -
Check
Terminal window kubectl get pods -n observability -l app.kubernetes.io/name=opentelemetry-collectorThe pod must be
Running.
-
Download and check the digest
Terminal window VERSION="0.155.0"BASE="https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${VERSION}"curl -sSLO "${BASE}/otelcol-contrib_${VERSION}_linux_amd64.tar.gz"curl -sSLO "${BASE}/opentelemetry-collector-releases_otelcol-contrib_checksums.txt"sha256sum --ignore-missing -c opentelemetry-collector-releases_otelcol-contrib_checksums.txttar -xzf "otelcol-contrib_${VERSION}_linux_amd64.tar.gz" otelcol-contribThe check must print
otelcol-contrib_0.155.0_linux_amd64.tar.gz: OKbefore extraction: a digest checked afterwards protects nothing. -
Create the config (same content as for Docker)
Reuse the
config.yamlfile from the Docker tab, unchanged: the listening ports and the pipeline are identical. -
Validate the configuration
Terminal window ./otelcol-contrib validate --config config.yamlThe command prints nothing and exits with 0 when the file is valid; a typo in an exporter type exits with 1 and the exact message.
-
Run
Terminal window ./otelcol-contrib --config config.yaml
Your first pipeline: traces to Jaeger
Now that the Collector is running, let's configure a realistic pipeline that sends traces to Jaeger, a traces backend that is easy to run locally. We use Jaeger 2, since branch 1 has reached end of life.
Prerequisites
The Collector and Jaeger must reach each other by name: a dedicated Docker network takes care of that, and only Jaeger's interface port is published on the workstation.
# Create a shared networkdocker network create observability
# Start Jaeger (only the UI exposed)docker run -d --name jaeger \ --network observability \ -p 127.0.0.1:16686:16686 \ jaegertracing/jaeger:2.22.0@sha256:836b967b5abcf1f7758066aa6b348619267a2f1459f72d472840570f9bd88a17The Jaeger interface is at http://localhost:16686.
Configuration
The file reuses the minimal configuration and adds an otlp_grpc/jaeger
exporter: the suffix after the slash is a free name, which lets you
declare several exporters of the same type.
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 spike_limit_mib: 128 batch: timeout: 5s send_batch_size: 1000
exporters: # Export to Jaeger via OTLP otlp_grpc/jaeger: endpoint: jaeger:4317 tls: insecure: true
# Keep debug to see what goes through debug: verbosity: basic
extensions: health_check: endpoint: 0.0.0.0:13133 zpages: endpoint: 0.0.0.0:55679
service: extensions: [health_check, zpages] pipelines: traces: receivers: [otlp] processors: [memory_limiter, batch] exporters: [otlp_grpc/jaeger, debug]The path of a trace reads in four steps:
- Applications send OTLP traces to the Collector (port 4317 or 4318)
- The Collector limits memory (
memory_limiter) to avoid OOMs - Traces are grouped in batches of 1000 or every 5 seconds
- Traces are sent to Jaeger AND printed in the logs (debug)
Restart the Collector
The Collector must join the observability network to resolve the name
jaeger: we recreate it with the new configuration, also publishing the
zpages port.
# Stop the old collectordocker stop otel-collector && docker rm otel-collector
# Restart with the network and the new configdocker run -d \ --name otel-collector \ --network observability \ -p 127.0.0.1:4317:4317 \ -p 127.0.0.1:4318:4318 \ -p 127.0.0.1:13133:13133 \ -p 127.0.0.1:55679:55679 \ -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml:ro \ otel/opentelemetry-collector-contrib:0.155.0@sha256:4935caa35e9a4cb387e35732e8fb22b2b5759af8d12e7043357f03837f6e8df5Connecting your applications to the Collector
Your applications only need to know one address, the Collector's. There are three ways to get there, from the most explicit to the most declarative: the SDK in the code, auto-instrumentation at launch, environment variables on Kubernetes.
Option 1: OpenTelemetry SDK (recommended)
The SDK is configured in the code: you create an OTLP exporter that targets the Collector, then a tracer provider that uses it. The examples below do the same thing in four languages.
pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlpfrom opentelemetry import tracefrom opentelemetry.sdk.trace import TracerProviderfrom opentelemetry.sdk.trace.export import BatchSpanProcessorfrom opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
# Configure the OTLP exporter towards the Collectorotlp_exporter = OTLPSpanExporter( endpoint="http://localhost:4317", # Collector address insecure=True)
# Configure the tracerprovider = TracerProvider()provider.add_span_processor(BatchSpanProcessor(otlp_exporter))trace.set_tracer_provider(provider)
# Use ittracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("my-operation"): # Your code here print("This operation is traced!")npm install @opentelemetry/api @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-grpcconst { NodeSDK } = require('@opentelemetry/sdk-node');const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');
const sdk = new NodeSDK({ traceExporter: new OTLPTraceExporter({ url: 'http://localhost:4317', // Collector address }),});
sdk.start();
// In your codeconst opentelemetry = require('@opentelemetry/api');const tracer = opentelemetry.trace.getTracer('my-service');
const span = tracer.startSpan('my-operation');// Your codespan.end();go get go.opentelemetry.io/otelgo get go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpcpackage main
import ( "context" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "go.opentelemetry.io/otel/sdk/trace")
func main() { ctx := context.Background()
// Configure the OTLP exporter exporter, _ := otlptracegrpc.New(ctx, otlptracegrpc.WithEndpoint("localhost:4317"), otlptracegrpc.WithInsecure(), )
// Configure the tracer provider tp := trace.NewTracerProvider( trace.WithBatcher(exporter), ) otel.SetTracerProvider(tp)
// Use it tracer := otel.Tracer("my-service") _, span := tracer.Start(ctx, "my-operation") defer span.End()}<dependency> <groupId>io.opentelemetry</groupId> <artifactId>opentelemetry-sdk</artifactId> <version>1.68.0</version></dependency><dependency> <groupId>io.opentelemetry</groupId> <artifactId>opentelemetry-exporter-otlp</artifactId> <version>1.68.0</version></dependency>import io.opentelemetry.api.trace.Tracer;import io.opentelemetry.api.trace.Span;import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;import io.opentelemetry.sdk.trace.SdkTracerProvider;import io.opentelemetry.sdk.trace.export.BatchSpanProcessor;
public class Application { public static void main(String[] args) { // Configure the exporter OtlpGrpcSpanExporter exporter = OtlpGrpcSpanExporter.builder() .setEndpoint("http://localhost:4317") .build();
SdkTracerProvider tracerProvider = SdkTracerProvider.builder() .addSpanProcessor(BatchSpanProcessor.builder(exporter).build()) .build();
Tracer tracer = tracerProvider.get("my-service");
Span span = tracer.spanBuilder("my-operation").startSpan(); // Your code span.end(); }}Option 2: Auto-instrumentation (zero code)
For popular frameworks, OpenTelemetry instruments the application without changing its code: a launcher or an agent intercepts the libraries at startup, and environment variables give the Collector address and the protocol to use.
pip install opentelemetry-distro opentelemetry-exporter-otlpopentelemetry-bootstrap -a install# Run your app with auto-instrumentationOTEL_SERVICE_NAME=my-service \OTEL_EXPORTER_OTLP_PROTOCOL=grpc \OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 \opentelemetry-instrument python app.py# Download a specific agent version and its checksum fileVERSION="v2.32.0"BASE="https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/${VERSION}"curl -sSLO "${BASE}/opentelemetry-javaagent.jar"curl -sSLO "${BASE}/checksums.txt"sha256sum --ignore-missing -c checksums.txt# Run with the agentjava -javaagent:opentelemetry-javaagent.jar \ -Dotel.service.name=my-service \ -Dotel.exporter.otlp.endpoint=http://localhost:4317 \ -Dotel.exporter.otlp.protocol=grpc \ -jar my-app.jarWithout the otel.exporter.otlp.protocol property, the Java 2.x agent sends
http/protobuf: you must then target port 4318, not 4317.
npm install @opentelemetry/auto-instrumentations-node# Run with auto-instrumentationOTEL_SERVICE_NAME=my-service \OTEL_EXPORTER_OTLP_PROTOCOL=grpc \OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 \node --require @opentelemetry/auto-instrumentations-node/register app.jsOption 3: Environment variables (Kubernetes)
On Kubernetes, the configuration goes through the container's
environment variables: the Collector address uses the cluster's internal
DNS, here the otel-collector service in the observability namespace.
apiVersion: apps/v1kind: Deploymentmetadata: name: my-servicespec: template: spec: containers: - name: app image: my-image:1.0.0 env: - name: OTEL_SERVICE_NAME value: "my-service" - name: OTEL_EXPORTER_OTLP_ENDPOINT value: "http://otel-collector.observability.svc:4317" - name: OTEL_EXPORTER_OTLP_PROTOCOL value: "grpc" - name: OTEL_TRACES_EXPORTER value: "otlp"Validation: checking that it works
Validation is done end to end: you generate a test trace, see it go by in the Collector logs, then find it in Jaeger. The commands target 0.155.0 and Jaeger 2.22.0.
-
Generate test traffic
If you do not have an instrumented application yet, use
telemetrygen:Terminal window docker run --rm --network observability \ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:v0.155.0@sha256:32d1762abb401e36dd8cfdf60a71075b41bd996a0cfb7c8d2e6eac4d609625b9 \traces --otlp-insecure --otlp-endpoint otel-collector:4317 --traces 1The
--traces 1option is mandatory: without it,telemetrygenstops witheither traces or duration must be greater than 0. Also note thevprefix of the image tag, which does not exist without it. -
Check the Collector logs
Terminal window docker logs otel-collector --tail 50With
verbosity: basic, thedebugexporter writes oneinfo Tracesline per batch received, with the number of spans: it is the proof that the trace went through the pipeline. -
Check in Jaeger
Open http://localhost:16686, select the
telemetrygenservice in the drop-down menu then click Find Traces. On the command line, the Jaeger 2 v3 API lists the known services:Terminal window curl -s http://localhost:16686/api/v3/services{"services":["telemetrygen"]}
Full pipeline: metrics, logs and traces
A single configuration can carry the three signals, each in its own
pipeline: traces to Tempo, metrics to Mimir, logs to Loki through its native
OTLP endpoint. On 0.155.0, this file passes otelcol-contrib validate and
starts without any alias warning.
receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318
# Scrape the apps' Prometheus metrics prometheus: config: scrape_configs: - job_name: 'applications' scrape_interval: 30s static_configs: - targets: ['app1:8080', 'app2:8080']
processors: memory_limiter: check_interval: 1s limit_mib: 512 spike_limit_mib: 128 batch: timeout: 5s send_batch_size: 1000 # Add attributes to all the data resource: attributes: - key: deployment.environment.name value: production action: insert
exporters: # Traces to Tempo otlp_grpc/tempo: endpoint: tempo:4317 tls: insecure: true
# Metrics to Mimir (remote write compatible) prometheus_remote_write: endpoint: http://mimir:9009/api/v1/push
# Logs to Loki, through its native OTLP endpoint (Loki 3) otlp_http/loki: endpoint: http://loki:3100/otlp
debug: verbosity: basic
extensions: health_check: endpoint: 0.0.0.0:13133 zpages: endpoint: 0.0.0.0:55679
service: extensions: [health_check, zpages] pipelines: traces: receivers: [otlp] processors: [memory_limiter, resource, batch] exporters: [otlp_grpc/tempo, debug]
metrics: receivers: [otlp, prometheus] processors: [memory_limiter, resource, batch] exporters: [prometheus_remote_write]
logs: receivers: [otlp] processors: [memory_limiter, resource, batch] exporters: [otlp_http/loki]Loki: watch the cardinality. Through the OTLP endpoint, Loki stores the most
common resource attributes (service.name, k8s.namespace.name…) as
labels, and the rest as line metadata. A high-variety attribute set at the
resource level, such as a request ID, would become a label and multiply the
streams: keep these values in the log attributes, never in the resource.
Troubleshooting
Most failures sit between the Collector and its backend: the trace arrives
(it shows up in debug) but does not leave. The table reads in the order of
the flow, and the diagnostic block that follows covers each row.
| Symptom | Likely cause | Solution |
|---|---|---|
connection refused | Collector not running or wrong endpoint | docker ps + check the URL |
| No traces in Jaeger | Exporter misconfigured | Check the Collector logs |
| Traces in logs but not in the backend | Backend unreachable | Test the connection: curl backend:port |
| Collector OOM | No memory_limiter | Add the processor first |
| Data lost | Batch too big or timeout too short | Reduce send_batch_size |
| Health check fails | Collector crashed or badly started | docker logs otel-collector |
Connection reset towards port 4317 | SDK or agent sending http/protobuf to the gRPC port | OTEL_EXPORTER_OTLP_PROTOCOL=grpc, or target port 4318 |
unknown type: "loki" at startup | Exporter removed from the Collector | otlp_http to http://loki:3100/otlp |
| zpages unreachable | Extension not enabled or wrong port | Check service.extensions |
Diagnostic commands
These commands go from the simplest to the finest. The zpages expose the
internal state: pipelinez lists the pipelines and their components,
servicez the version and the loaded configuration. On 0.155.0, tracez
answers 404: the page is no longer available.
# Collector statedocker ps | grep otel-collector
# Health checkcurl http://localhost:13133/
# Recent logsdocker logs otel-collector --tail 100
# Validate the configurationdocker exec otel-collector otelcol-contrib validate --config /etc/otelcol-contrib/config.yaml
# Pipeline debug (zpages)curl http://localhost:55679/debug/pipelinezcurl http://localhost:55679/debug/servicezHow do you diagnose a pipeline that delivers nothing?
A pipeline that delivers nothing is diagnosed with the Collector's internal
metrics, never with its health_check. Enable the service.telemetry block
so that the Collector publishes its otelcol_* counters on port 8888. Keep
two traps in mind: a green health_check does not prove that the export to
the backend works, it only says that the Collector is running; and a missing
otelcol_receiver_accepted_spans series is not a zero, it means that nothing
reaches the receiver. The four failures explained, the configuration and the
reading method are in the dedicated lesson,
Diagnosing an OpenTelemetry pipeline that delivers nothing (in French).
Production checklist
Before going to production, validate these points. Each one picks up a step of the lesson, and most can be checked with one command or one line of configuration.
- Pinned version: tag and digest, never
:latest - No port conflict: Jaeger and Collector on the same Docker network
- health_check enabled:
curl localhost:13133/returnsServer available - memory_limiter configured: prevents OOMs
- Internal metrics enabled:
service.telemetryand port 8888, to readotelcol_* - debug exporter removed: or set to
verbosity: basic - Current exporter names:
otlp_grpc,otlp_http,prometheus_remote_write - OTLP protocol declared:
OTEL_EXPORTER_OTLP_PROTOCOLavoids gRPC/HTTP surprises - Bind to localhost in dev:
-p 127.0.0.1:4317:4317 - Loki labels under control: low cardinality (service, namespace, level)
- Kubernetes: clear choice between DaemonSet (agent) and Deployment (gateway)
Key takeaways
- The Collector is an intermediary between your apps and your backends
- Receiver → Processor → Exporter architecture for each pipeline
- Always use
memory_limiterandbatch(in this order) - Enable
health_checkandzpagesfor diagnostics - Your apps send OTLP: port 4317 (gRPC) or 4318 (HTTP)
- The default protocol depends on the SDK (the Java 2.x agent sends
http/protobuf): declareOTEL_EXPORTER_OTLP_PROTOCOL - With Helm, the
imageblock is mandatory and each exporter must appear in a pipeline to send anything - Pin the versions, and check the exporter names on every
upgrade:
lokihas disappeared,otlpbecameotlp_grpc - Change backend by modifying the config, not the code