OpenTelemetry Collector Memory Limiter: Why It Refuses Spans

Learn why the OpenTelemetry Collector memory limiter refuses spans, how soft and hard limits work, what retries do, and how to tell it from queue failures.

Ephraim Duncan

The OpenTelemetry Collector memory limiter refuses spans because the memory_limiter processor measured heap usage above its soft limit and started returning errors to whatever sent the data. The message "data refused due to high memory usage" is backpressure, not a crash and not necessarily data loss. It is the processor doing the job it was configured to do.

That distinction matters if you run a Collector in front of LLM or agent telemetry. Agent runs emit bursts of spans: a model call, three tool steps, a retrieval, a retry. A burst arrives, memory climbs between checks, and the limiter says no. This post gives you the real numbers behind the soft and hard limits, what happens to a refused batch, and how to separate a memory_limiter refusal from an exporter queue failure. Settings here are checked against the official README at Collector v0.166.0.

What the memory limiter refusing spans means

The memory limiter refuses spans when its periodic memory check finds the Collector above the soft limit, and it keeps refusing until memory drops back below it. The processor exists to prevent out of memory situations by checking usage on a timer, refusing incoming data, and forcing garbage collection.

Two things follow. First, the check is periodic, not continuous. Memory can grow between checks, which is exactly why a spike allowance exists. Second, a refusal is an error returned to the component upstream of the limiter. It is not the Collector silently throwing your spans away.

The processor helps mitigate out of memory situations, but it is not a replacement for properly sizing and configuring the Collector. Treat refusals as a signal that the Collector is undersized or overloaded, not as a setting to tune away.

Soft limit, hard limit and spike limit: the real numbers

The hard limit is limit_mib, and the soft limit is limit_mib minus spike_limit_mib. Refusals begin at the soft limit, not the hard one.

Here is a worked example. Set limit_mib: 4000 and spike_limit_mib: 800. The hard limit is 4,000 MiB. The soft limit is 4,000 minus 800, which is 3,200 MiB. Once heap usage crosses 3,200 MiB at a check, the processor starts refusing data and forcing GC. If usage somehow reaches 4,000 MiB, the hard limit applies and garbage collection is forced harder.

The settings, as the README describes them:

  • check_interval: how often memory is measured. It must be greater than zero, and the recommended value is 1s.

  • limit_mib: the hard heap limit in MiB. Real process memory typically runs about 50 MiB higher than the heap figure.

  • spike_limit_mib: headroom for growth between checks. It must be less than limit_mib, and the README recommends roughly 20% of the limit.

  • limit_percentage: an alternative hard limit as a percentage of available memory on supported Linux and cgroup systems. If both this and limit_mib are set, limit_mib wins.

  • spike_limit_percentage: the percentage-based spike allowance that pairs with limit_percentage.

One trap: a spike limit that is too small makes the soft limit sit close to the hard limit, so a burst can blow past it between checks. A 20% spike limit is the starting point, and a bursty agent workload may want more.

Check each setting against a named Collector version

Verify every setting against the README for the exact Collector version you run, because field names and requirements change between releases.

Two practical checks. Open the processor's config.go for your version, since the README points there as the config spec, and confirm that the fields you set exist and validate. And read the release notes between your version and the one you are moving to, so a renamed or newly required field does not turn a working limiter into a failed startup.

Pin the version in your notes next to the config. When someone asks "why does this refuse at 3,200 MiB," the answer should name the version the numbers were checked against, not "whatever was latest when we copied the example."

What happens to a refused batch: upstream retry behavior

When the memory limiter refuses data, it returns a non-permanent error, which tells the caller the failure is transient and the batch is worth retrying. Whether the data survives depends entirely on what sits upstream.

A receiver that gets the refusal either retries the batch or passes the backpressure back to the sender. For a remote sender, such as an app SDK exporting over OTLP, that means its own retry and queue settings decide the outcome. A sender that retries with backoff will deliver the batch once memory recovers. A sender that does not retry, or gives up after a short window, loses it.

So a refusal message alone does not prove spans were dropped. It proves one attempt was rejected. Sustained overload combined with non-retrying senders is where actual data loss occurs.

Check the sender, not just the Collector. If your SDKs drop spans after one failed export, a brief memory spike becomes permanent loss. If they retry, the same spike is invisible downstream.

Memory limiter refusal or exporter queue failure? Tell them apart

A memory limiter refusal happens at the front of the pipeline and rejects data coming in, while an exporter queue failure happens at the back and rejects data going out. They look similar in a dashboard and have different fixes.

The Collector's internal telemetry gives you the split:

Signal Where it happens Metric family to watch What it points to
memory_limiter refusal Receiver side, before processing otelcol_receiver_refused_* Collector memory above the soft limit
Exporter queue full Exporter side, after processing otelcol_exporter_enqueue_failed_* Sending queue overflow, often a slow backend

Rising otelcol_receiver_refused_* points to refusals upstream of the pipeline. Rising otelcol_exporter_enqueue_failed_* points to the sending queue overflowing. Also check queue size against capacity and export failure counts, because the two problems feed each other: a slow backend fills the queue, the queue holds batches in memory, and memory pressure then trips the limiter.

If you see both, fix the backend path first. For the queue side, see OpenTelemetry Collector Sending Queue Full: What to Check. To locate where spans vanish end to end, use OpenTelemetry Collector Dropped Spans: Find the Drop.

Fix it: processor order, GOMEMLIMIT and sizing

Put memory_limiter first in every pipeline, before batch and any other processor. It has to refuse data before downstream processors allocate memory for it. A limiter placed after batch lets the batch processor buffer data the limiter never gets to push back on.

A minimal pipeline looks like this in shape: receivers, then memory_limiter, then batch, then exporters. Keep that order in each pipeline you define.

Set GOMEMLIMIT alongside the processor. The Collector guidance recommends roughly 80% of the Collector's hard memory limit, so with a 4,000 MiB hard limit you would aim near 3,200 MiB. This gives the Go runtime a target to collect against before the limiter has to start refusing.

Then size honestly:

  • Give the Collector more memory if refusals are routine rather than rare.

  • Add Collector replicas behind a load balancer if one instance cannot hold your burst.

  • Raise spike_limit_mib if refusals cluster around bursts of agent activity.

  • Fix a slow exporter path so queued batches stop pinning memory.

If the exporter queue is the memory hog, a disk-backed queue can relieve it. See OpenTelemetry Collector Persistent Queue Setup.

Once the Collector is stable, the spans it forwards still need somewhere to be read. telemetry.dev is LLM observability for AI apps and agents, built on OpenTelemetry, and it accepts data from any OTLP/HTTP exporter or OpenTelemetry Collector, so tuning your Collector stays your job and reading the resulting traces is where it fits.

FAQ: refusing data, dropped spans and next steps

The questions below cover the follow-ups that come up most once the limiter starts refusing. The short version: a refusal is backpressure, order and sizing are the fix, and the metrics tell you which side is failing. Use the FAQ below for the specific answers, then move to the conclusion for the next step.

Treat refusals as a sizing signal, then verify the spans arrive

The memory limiter refusing spans is the Collector protecting itself, and the right response is to size it, order it first, and confirm your senders retry. Once memory is stable, check that the traces you care about actually land. Send your Collector's OTLP output to a free telemetry.dev workspace (30k units) and read one failed agent run end to end.

Share this article

Related posts

OpenTelemetry Collector Persistent Queue Setup

Set up an OpenTelemetry Collector persistent queue with file_storage and sending_queue, mount durable disk, run a kill test, and see where spans still get lost.