save your seat
All posts

OpenTelemetry Collector: Configuration and Use

Observability
May
2
2025
Apr
30
2025

An Introduction to the OpenTelemetry Collector

The OpenTelemetry collector is a fundamental component for modern observability pipelines, serving as the backbone for collecting, processing, and exporting telemetry data. This article provides essential knowledge for those looking to implement their first OpenTelemetry collector deployment. We'll cover the basics of what OpenTelemetry is, the collector's role in your observability strategy, and step-by-step configuration instructions to get you up and running quickly. Whether you're new to observability or transitioning from legacy monitoring tools, this OpenTelemetry Collector 101 guide will equip you with the foundation needed to start building robust telemetry pipelines.

What Is OpenTelemetry?

OpenTelemetry (OTel) is an open-source observability framework created to provide unified instrumentation for collecting metrics, logs, and traces across distributed systems. Backed by the Cloud Native Computing Foundation (CNCF), OpenTelemetry allows developers to gain deep insights into the behavior and performance of their applications using a single standard for telemetry data.

What Is OpenTelemetry Collector?

The OpenTelemetry Collector is a vendor-agnostic, pluggable service that receives, processes, and exports telemetry data. It plays a central role in OpenTelemetry-based observability architectures by acting as a centralized agent that routes telemetry data between sources and destinations.

Key Features of the OTel Collector

  • Receivers: Ingest telemetry from various sources (e.g., OTLP, Prometheus, filelog).
  • Processors: Modify, enrich, batch, or filter telemetry data.
  • Exporters: Send telemetry to observability platforms like Prometheus, Jaeger, Elasticsearch, or commercial vendors.
  • Extensions: Support optional features like health checks, authentication, or zPages for debugging.

The Collector can run as an agent on a host or as a gateway between telemetry sources and backends. It supports configuration via a single YAML file.

Configuring and Using OpenTelemetry Collector

Follow this step-by-step guide to configure and use the OTel Collector in a basic observability pipeline.

Step 1: Install the OpenTelemetry Collector

You can download and run the OpenTelemetry Collector binary, Docker image, or use it as part of a Kubernetes deployment.

Using Docker:

docker run --rm -p 4317:4317 -p 55681:55681 \
  -v $(pwd)/otel-config.yaml:/etc/otel/config.yaml \
  otel/opentelemetry-collector:latest \
  --config /etc/otel/config.yaml

Using Binary (Linux):

wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/latest/download/otelcol_0.86.0_linux_amd64.tar.gz
tar -xzf otelcol_0.86.0_linux_amd64.tar.gz
./otelcol --config otel-config.yaml

Step 2: Create a Configuration File

The OTel Collector uses a YAML configuration file with four main sections:

  • receivers
  • processors
  • exporters
  • service

Step 3: Define Receivers

Receivers tell the Collector where to get data from. Here’s an example to receive OTLP data:

receivers:
  otlp:
    protocols:
      grpc:
      http:

Step 4: Define Processors

Processors modify or enrich telemetry data. The batch processor improves performance by batching data before export.

processors:
  batch:
  memory_limiter:
    check_interval: 1s
    limit_mib: 400

Step 5: Define Exporters

Exporters send the data to its destination. You can use multiple exporters. Here’s an example with Prometheus and OTLP:

exporters:
  prometheus:
    endpoint: "0.0.0.0:8889"

  otlphttp:
    endpoint: "https://my-observability-platform.com/v1/metrics"

Step 6: Configure the Service Pipeline

The service section defines pipelines that connect receivers, processors, and exporters.

service:
  pipelines:
    metrics:
      receivers: [otlp]
      processors: [batch, memory_limiter]
      exporters: [prometheus, otlphttp]

You can define multiple pipelines — for metrics, logs, or traces — each with its own configuration.

Step 7: Start the Collector

Once your configuration file is ready, run the Collector:

otelcol --config otel-config.yaml

Visit http://localhost:8889/metrics to verify Prometheus is receiving data.

Step 8: Instrument Your Application

Use an OpenTelemetry SDK (e.g., in Go, Java, Python) to send telemetry to the Collector.

Python example:

from opentelemetry import metrics
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader

exporter = OTLPMetricExporter(endpoint="http://localhost:4317", insecure=True)
meter_provider = MeterProvider(

This setup sends metrics to the Collector, which processes and forwards them to Prometheus and any other configured exporters.

Best Practices for Configuring OpenTelemetry Collector

  • Keep it modular: Use reusable configurations for different environments.
  • Secure endpoints: Use TLS and authentication for receiving and exporting data.
  • Use batching and memory limits: Prevent overloads during spikes.
  • Leverage semantic conventions: Tag data with service name, environment, and other identifiers.
  • Monitor the collector itself: Export internal metrics for Collector health and performance.

Troubleshooting OpenTelemetry Collector

Common Configuration Errors

  • Port conflicts: Ensure OTLP and Prometheus ports aren’t already in use.
  • Missing pipeline components: All pipelines must include at least one receiver and one exporter.
  • YAML syntax issues: Use a linter or config validator to avoid formatting errors.

Useful Debugging Tips

Run the Collector in debug mode:

otelcol --config otel-config.yaml --log-level debug

Use zpages to expose live diagnostic data:

extensions:
  zpages:
    endpoint: :55679

Validate the config before running:

otelcol --config otel-config.yaml --dry-run

Conclusion

The OpenTelemetry Collector is the glue that connects your instrumented applications with backend observability platforms. With a flexible configuration system, support for multiple receivers and exporters, and built-in processing capabilities, it’s a powerful tool for unifying your telemetry pipeline.

By learning how to write and maintain a robust otel collector config, developers can ensure consistent observability across services — improving monitoring, performance, and operational efficiency.

Ready to make your telemetry pipeline more intelligent and cost-effective?

Schedule a demo with Sawmills.