Observability Africa

OpenTelemetry Collector Memory Limits: Preventing Backpressure from Becoming Data Loss

OpenTelemetry Collector memory limiter controlling telemetry flow under backpressure

When an OpenTelemetry Collector runs out of memory, the visible failure may look simple: a restart, an out-of-memory kill, or a sudden gap in telemetry. The real failure often began earlier. Data accumulated faster than the Collector could export it, queues held live data in memory, and backpressure reached components that were not prepared to retry.

A memory limiter can protect the Collector process, but it cannot guarantee that telemetry will survive. Teams need to understand the full pressure path, from receivers to processors, queues, exporters, and the destination.

Why Collector memory pressure is an operational risk

The OpenTelemetry Collector receives, processes, and exports traces, metrics, and logs. Its memory use depends on traffic volume, batch sizes, processors, exporter queues, and the behaviour of downstream systems.

A backend slowdown can therefore become a Collector problem. Exporters send more slowly, queues retain data longer, and memory consumption rises. If the process is killed, the team may lose the same telemetry needed to explain the incident.

This risk matters anywhere infrastructure capacity is constrained or connectivity is unreliable. It is especially important when Collector instances have small memory limits, traffic arrives in bursts, or a remote backend is reached through an unstable network path.

What the memory limiter actually does

The OpenTelemetry memory limiter documentation describes a soft limit and a hard limit.

This behaviour protects the process, but the documentation includes an important warning: data can be permanently lost when the component before the limiter does not retry correctly.

The memory limiter is therefore a safety control, not a storage system and not a complete reliability strategy.

Processor order matters

OpenTelemetry recommends placing memory_limiter first in the processor chain. This allows the Collector to shed load before later processors allocate more memory or hold data that cannot be flushed.

Processors that discard data, such as filters or samplers, should usually run early. Enrichment and transformation should happen only for data that will continue through the pipeline. Batching belongs later, after filtering and transformation.

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 80
    spike_limit_percentage: 20
  batch: {}

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, batch]
      exporters: [otlp]

This example shows the order, not a universal production value. Limits must be tested against the Collector’s container limit, traffic pattern, processor configuration, and expected bursts.

Backpressure needs an end-to-end design

Backpressure works only when every important boundary behaves as expected.

Ask these questions:

If these questions are unanswered, a memory limiter may prevent a crash while data loss continues elsewhere.

Set limits from the deployment boundary

For containerized Collectors, the OpenTelemetry project recommends coordinating the limiter with the container’s memory restriction. Percentage-based limits can be useful when the host environment exposes an appropriate cgroup memory limit. Fixed MiB values may be clearer for virtual machines or other environments with predictable capacity.

The project currently recommends configuring GOMEMLIMIT alongside the memory limiter. Its documented starting point is 80 percent of the Collector’s hard memory limit. The memory limiter should still be tested under realistic load because incoming data can consume memory before rejection takes effect.

Do not copy a limit from another environment without testing. A configuration that works for metrics may fail when high-cardinality attributes, large logs, or trace bursts enter the same Collector.

Monitor the Collector as a production service

A Collector should not be treated as invisible plumbing. Monitor it like any other critical service.

At minimum, teams should watch:

Alerting should identify sustained pressure before the process reaches its hard limit. A rising queue with flat export throughput is often more useful than a late alert about memory alone.

For a broader failure model, see our guide to designing OpenTelemetry Collector resilience during outages. Teams should also control the data entering the pipeline through a practical metric cardinality budget.

A practical validation exercise

Test the pipeline under controlled pressure before relying on it during an incident.

  1. Apply a realistic memory limit to the Collector.
  2. Generate representative telemetry, including expected bursts.
  3. Slow or temporarily interrupt the backend.
  4. Observe queue growth, memory use, refusals, retries, and drops.
  5. Restore the backend and confirm that the pipeline recovers.
  6. Compare retained telemetry with the incident questions the team must answer.

The goal is not to prove that the Collector never refuses data. The goal is to understand how the system behaves when it does.

Practical takeaways

Organizations that want an independent review of Collector capacity, queue behaviour, signal volume, and failure paths can learn about the Observability Africa audit and consulting service. Sponsorship of community education and practical engineering resources is also welcome, with editorial independence preserved.

Sources

Exit mobile version