The OpenTelemetry Collector receives, processes and exports telemetry. A single instance with a ten-line config works for a demo. In production it becomes a critical path for all your observability data, and a few practices make the difference between a quiet pipeline and a source of incidents.

1. Choose a deployment pattern

PatternHowGood for
AgentOne Collector per host or node (DaemonSet)Local collection, host metrics, low latency for apps
GatewayA pool of Collectors behind a load balancerCentral processing, tail sampling, credentials in one place
Agent + gatewayAgents forward to gatewaysLarger setups

Start with agents if you also need host or Kubernetes metadata; add a gateway when you need tail sampling or want backend credentials kept in one place.

2. Always use memory_limiter and batch

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 80
    spike_limit_percentage: 20
  batch:
    send_batch_size: 8192
    timeout: 5s

Put memory_limiter first in every pipeline so the Collector refuses data before it runs out of memory, and batch last before exporters to reduce request overhead.

3. Configure retries and queues on exporters

Backends have bad minutes. Exporters with a sending queue and retry on failure ride them out without dropping data:

exporters:
  otlphttp/backend:
    endpoint: https://otlp.example.com
    sending_queue: { enabled: true, queue_size: 5000 }
    retry_on_failure: { enabled: true, initial_interval: 5s, max_elapsed_time: 300s }

For durability across restarts, a persistent queue with the file storage extension keeps buffered data on disk.

4. Redact before data leaves

Remove secrets and personal data in the Collector, centrally, rather than trusting every service:

processors:
  attributes/redact:
    actions:
      - { key: http.request.header.authorization, action: delete }
      - { key: user.email, action: hash }

5. Drop noise early

Filter health-check spans and noisy logs before they cost anything downstream. See telemetry pipeline for a full example.

6. Sample at the right tier

Head sampling in SDKs is cheapest. Tail sampling in a gateway can keep all errors and slow traces, but every span of a trace must reach the same Collector instance; use the load-balancing exporter keyed by trace ID in front of the sampling tier. See trace sampling.

7. Add Kubernetes and resource metadata

The k8sattributes and resourcedetection processors add pod, namespace, node and cloud attributes, which make traces and metrics far easier to slice during incidents.

8. Monitor the Collector

The Collector exposes its own metrics: accepted and refused spans, exporter send failures, queue size. Alert on export failures and a growing queue, and watch its memory against its limit. A silent Collector failure looks like "everything is quiet", which is the worst kind of false confidence.

9. Version and test configs

Keep configs in Git, validate them in CI (otelcol validate --config=... with the binary you run), and roll out changes gradually. A typo in a processor name can stop a whole pipeline.

10. Pin the distribution

Use the contrib distribution (or a custom build with only the components you need) and pin the version. Upgrade deliberately; component behaviour can change between releases.

Sending to VitalRix

VitalRix accepts OTLP over HTTP with JSON. Use the otlphttp exporter with encoding: json, the traces and metrics endpoints, and your API key in the x-api-key header; the OTLP glossary entry has a complete configuration, and the OpenTelemetry guides show the SDK side for each language.

A production-ready pipeline

Putting the practices together, a gateway configuration might look like this:

receivers:
  otlp:
    protocols:
      grpc: { endpoint: 0.0.0.0:4317 }
      http: { endpoint: 0.0.0.0:4318 }
processors:
  memory_limiter: { check_interval: 1s, limit_percentage: 80, spike_limit_percentage: 20 }
  attributes/redact:
    actions:
      - { key: http.request.header.authorization, action: delete }
  filter/health:
    traces:
      span:
        - 'attributes["http.route"] == "/health"'
  batch: {}
exporters:
  otlphttp/vitalrix:
    encoding: json
    traces_endpoint: ${env:VITALRIX_API}/api/v1/traces/otlp/v1/traces
    metrics_endpoint: ${env:VITALRIX_API}/api/v1/metrics/otlp/v1/metrics
    headers: { x-api-key: ${env:VITALRIX_KEY} }
    sending_queue: { enabled: true, queue_size: 5000 }
    retry_on_failure: { enabled: true }
service:
  telemetry:
    metrics: { level: normal }
  pipelines:
    traces:  { receivers: [otlp], processors: [memory_limiter, attributes/redact, filter/health, batch], exporters: [otlphttp/vitalrix] }
    metrics: { receivers: [otlp], processors: [memory_limiter, batch], exporters: [otlphttp/vitalrix] }

Troubleshooting checklist

  • Nothing arrives at the backend: check the Collector's own logs for exporter errors (401 means the key or header is wrong; 404 usually a wrong path).
  • Data arrives late: batching timeout too long, or the queue is backing up because the backend is slow.
  • Collector restarts: memory limits too low for the traffic, or memory_limiter missing.
  • Some services missing: they export to a different port or protocol than the receiver listens on (gRPC 4317 vs HTTP 4318).
  • Attributes missing: processors in the wrong order; for example filtering before enrichment.

Security notes

Bind receivers only on interfaces that need them, use TLS between agents and gateways when traffic crosses networks, keep backend credentials in environment variables or secrets, and restrict who can change Collector configuration, since it can redirect all telemetry.

See also OpenTelemetry Collector setup with Docker and what is OTLP.

Do I need the contrib distribution?

If you use processors and receivers beyond the core set (k8sattributes, tail_sampling, many receivers), yes. Some teams build a custom distribution with only what they need.

How much memory does a Collector need?

It depends on throughput, batching and queues. Start with a few hundred MB, set memory_limiter, and size from its own metrics under real load.

Should apps export to the gateway directly?

In small setups, yes. In larger ones, a local agent buffers and adds metadata before forwarding.

Try VitalRix free

Uptime monitoring, APM, logs, real user monitoring and status pages in one place. No credit card needed.