receivers: how the Collector accepts telemetry (from applications, agents, or other collectors)processors: optional transformers, batching, filtering, sampling, etc.exporters: destinations for processed telemetry (backends, files, console)service.pipelines: wiring that connectsreceivers→(processors)→exportersfor each signal (traces,metrics,logs)
Minimal configuration skeleton
A minimal skeleton to remind the top-level layout:otelcol or otelcol-contrib).
If validation fails, carefully check YAML indentation and keys—most issues are typos or mis-indentation. You can also run
otelcol --config customconfig.yaml --dry-run with some builds to surface runtime validation errors.Receivers
Receivers determine how the Collector accepts telemetry. The Collector supports many receiver types (examples: Fluent Forward, Prometheus, Jaeger, Kafka, OpenCensus, OTLP, Zipkin). Below are example snippets for several common receivers. Example receiver snippets:0.0.0.0binds to all interfaces. For local-only testing, use127.0.0.1or a specific interface.- Add TLS (cert/key) or authentication under each protocol if required.
Processors
Processors run between receivers and exporters and can transform, filter, aggregate, or limit telemetry. Common processors:batch, memory_limiter, attributes, resource, probabilistic_sampler. Processors are optional—omit them for minimal configs.
Example placeholder:
Exporters
Exporters send processed telemetry to destinations. Typical exporters include OTLP, Prometheus, Jaeger, Zipkin, Kafka, file, cloud vendor backends, and a debug exporter that prints telemetry to stdout. Example exporter snippets:logging instead of debug—check the Collector version and distribution.
Wiring it together: service.pipelines
Pipelines connectreceivers to processors and exporters. You must define a pipeline for each signal you want to process (traces, metrics, logs). Each pipeline lists receivers, optionally processors, and exporters.
Minimal complete config (receives OTLP gRPC + HTTP; exports all signals to debug):
Running the Collector (Docker example)
You can run the Collector as a binary, Docker image, Docker Compose service, or inside Kubernetes. Example using the contrib Docker image (includes many receivers/exporters):Be mindful of which image you use:
otel/opentelemetry-collector (core) includes fewer components than otel/opentelemetry-collector-contrib. Choose the image that contains the receivers/exporters you need. Binding ports to 127.0.0.1 restricts access to localhost; remove 127.0.0.1: to expose to all interfaces.Generating test telemetry with telemetrygen
Use telemetrygen to generate test traces, metrics, and logs to validate the Collector without instrumenting an application. Install telemetrygen (Go required):Common receivers and exporters (quick reference)
Extending this configuration
- Replace the
debugexporter with a production backend exporter (e.g., OTLP to vendor ingest, Prometheus remote write, Jaeger, Zipkin, Kafka). - Add processors like
batch,memory_limiter,resource, orattributesto shape telemetry. - Add multiple receivers and create pipelines that route different signals to different exporters.
- For production, enable TLS/authentication for receivers and exporters, and tune processor parameters (e.g.,
batchsizes, sampling rate).
Final full example (copy/paste)
Links and references
- OpenTelemetry Collector — official docs
- OpenTelemetry Collector Contrib repository
- telemetrygen (telemetry generator) — contrib command
- Kubernetes Concepts (for running Collector in K8s)