OpenTelemetry Collector: Setup, Configuration and Best Practices

By the OpenTelemetry.app editorial team 4 min readUpdated November 16, 2026
Illustrated cover for the guide: OpenTelemetry Collector: Setup, Configuration and Best Practices

The OpenTelemetry Collector is a vendor-neutral service that receives telemetry, processes it and sends it to one or more backends. It is optional — SDKs can export directly — but most production setups use it because it moves pipeline decisions out of application code.

Key takeaways

  • The Collector receives, processes and exports telemetry.
  • Use otelcol-contrib to explore; build a custom distribution for production.
  • Pipelines connect receivers, processors and exporters.
  • Agents run near apps; gateways centralise processing.

Collector distributions

The official releases repository builds several distributions, each available as binaries for many platforms and as multi-architecture container images:

  • otelcol — the core distribution with a minimal set of components.
  • otelcol-contrib — core plus a large set of community components (many receivers and exporters).
  • otelcol-k8s — tuned for Kubernetes.
  • otelcol-otlp — OTLP-only.
  • otelcol-ebpf-profiler — for the profiling signal.

For production you can also build a custom distribution with only the components you need using the OpenTelemetry Collector Builder (ocb).

Installing the Collector

Docker:

docker run -p 4317:4317 -p 4318:4318 \
  -v $(pwd)/config.yaml:/etc/otelcol-contrib/config.yaml \
  otel/opentelemetry-collector-contrib

Binaries and packages: download the archive or package for your OS and architecture from the official releases page, and verify it with the published checksums.

Kubernetes: the project maintains Helm charts and an OpenTelemetry Operator.

How the configuration works

A Collector configuration has four building blocks wired together in service.pipelines:

  • Receivers — accept data (OTLP, Prometheus scrape, host metrics, Kafka…).
  • Processors — transform it (batch, memory_limiter, attributes, filter, sampling…).
  • Exporters — send it on (OTLP, OTLP/HTTP, debug and vendor exporters).
  • Extensions — health checks and other non-data features.
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

processors:
  batch:

exporters:
  debug:
  otlphttp:
    endpoint: https://your-backend.example.com

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

Ports 4317 (gRPC) and 4318 (HTTP) are the OTLP defaults. The debug exporter prints received data to the console — useful while testing.

Deployment patterns

Agent vs gateway
PatternWhere it runsGood for
AgentNext to each app (sidecar, DaemonSet, host service)Low-latency local export, host metadata, host metrics
GatewayCentral, scalable cluster of CollectorsTail sampling, central policies, single egress to vendors

Many organisations combine both: agents forward to a gateway tier.

Useful processors to know

  • memory_limiter — protects the Collector from running out of memory under load.
  • batch — groups data before export for efficiency.
  • attributes / resource — add, update or delete attributes.
  • filter — drop data you do not need, such as health-check spans.
  • tail_sampling (contrib) — keep traces based on errors or latency after they complete.
  • k8sattributes (contrib) — enrich data with Kubernetes pod and namespace metadata.

Testing a configuration

Start with the debug exporter to confirm data arrives, then add real exporters one at a time. The Collector logs configuration errors at startup, and recent versions can validate a configuration file before running it. Keep configuration in version control and roll changes out gradually, because a broken pipeline silently drops telemetry.

Best practices

  • Always add memory_limiter and batch processors.
  • Pin the Collector version and read release notes before upgrading — many components are still pre-1.0.
  • Use the contrib distribution for exploration, then build a minimal custom distribution for production.
  • Redact sensitive attributes with the attributes or transform processors.
  • Monitor the Collector's own telemetry.

Frequently asked questions

Is the OpenTelemetry Collector free?

Yes, it is open source under Apache 2.0.

Which ports does the Collector use?

By default OTLP uses 4317 for gRPC and 4318 for HTTP. Other receivers use their own ports.

Does the Collector run on Windows?

Yes. The releases include Windows builds alongside Linux and macOS, plus container images.

Get OpenTelemetry from the official source

Free and open source (Apache 2.0) — the Go source .zip downloads straight from GitHub.

Download OpenTelemetry

Downloads the OpenTelemetry Go source code (.zip, main branch) from the official GitHub repository — you stay on this page.