ShowMerit

OpenTelemetry Collector Restarts Mid-Outage: file_storage Kept the Queue

On EKS, a gateway OpenTelemetry Collector's pod was deleted mid-outage. With a file_storage sending queue, the new pod restored 1,120 and 1,095 spans and every accepted span arrived; in memory, 1,204 and 1,152 never did.

Rechecked 1 Dec 2026: works with splunk-otel-collector chart 0.163.1 and 0.165.0 (on a GitHub runner)

Abhimanyu BajajPublished 30 Nov 20267 min readTested in eu-central-1Lab codeLab evidence

Run this yourself

On your AWS account

The full lab with your own AWS account and Splunk token. Follow the steps in this article, then run its clean up step so nothing keeps running.

git clone https://github.com/Abhimanyu9988/showmerit.git
cd showmerit/labs/opentelemetry-collector-restarts-mid-outage-file-storage

Splunk APM, service checkout-load, 29 Nov 16:07 to 16:18 Brussels time: request spikes from the four runs, with the two biggest after 4:13 PM

Splunk APM during the four runs (29 Nov, 16:07 to 16:18 Brussels time). The two runs after 4:13 PM used file_storage; Splunk APM counted 1,028 and 1,124 spans for them, against 453 and 415 in the two memory runs.

When Kubernetes deleted my gateway OpenTelemetry Collector's pod in the middle of a backend outage, a sending queue on disk (file_storage) brought back everything the old pod was holding: 1,120 and 1,095 spans, exactly the old pod's final queue. Every span the gateway had accepted arrived at the relay in front of Splunk, counted by trace and span ID, in both runs.

It also kept the spans the old pod took while it shut down. The pod went on accepting spans while it shut down (its last metrics read came 12.3 and 9.0 seconds after SIGTERM), so its queue grew from 992 and 960 spans to 1,120 and 1,095, and every one came back. With the same queue in memory, those spans and the whole backlog went with the pod: the replacement started empty, and 1,204 and 1,152 accepted spans never arrived.

What I tested

A gateway Collector forwards traces to the backend. When the backend can't be reached, it keeps what it can't send in its sending queue, in memory by default.

A node drain, an eviction or a rollout can land during a backend incident. So I made both happen at once on EKS:

Both configs are the queue I sized in last week's batching lab: exporter batching, sizer: items, queue_size: 100000. The only change is where the queue lives. Two runs each.

I counted three ways: the gateway's own metrics, every span the relay received (counted by trace and span ID, so a duplicate counts once), and Splunk APM.

Splunk Observability Cloud Kubernetes view of pod gateway-0 in StatefulSet gateway: one otel container Terminated and one Running, with the same for the scrape sidecar

The gateway pod in Splunk Observability Cloud's Kubernetes view: a terminated OpenTelemetry Collector container (otel) and the one that replaced it, each with its scrape sidecar.

With the queue in memory, the replacement starts empty

The old pod took 14 and 16 seconds to shut down. A sidecar kept reading the gateway's metrics until it stopped answering. In its last read, the queue had gone from 1,073 and 1,024 spans to 16, and the gateway's sent count hadn't moved (704 and 736). The queued spans weren't sent anywhere. The lab measured that they were gone, not how the Collector let go of them while shutting down.

Across both pods, the gateway accepted 2,111 and 1,983 spans. The relay received 907 and 831.

memory-1: old pod's queue before the delete, in its final read, and the new pod's first read

With file_storage, the replacement picks up the queue

With the queue on disk, the new pod's first log lines show it loading the queue:

info    queue/persistent_queue.go:186   Loaded queue metadata ...
info    queue/persistent_queue.go:454   Fetching items left for dispatch by consumers ...

It brought back 1,120 and 1,095 spans, exactly the old pod's final queue (a difference of 0 in both runs). After the outage, the gateway sent 2,056 of 2,056 and 2,251 of 2,251 accepted spans. The relay received the same numbers, with no duplicates.

The restart took as long either way: Ready 16 and 18 seconds after the delete in memory, 17 and 14 on disk. After the relay returned, the queue was back to normal in 7 to 10 seconds in every run.

disk-1: the new pod loads the queue and brings back 1,120 spans

What no queue setting can hold

Plan for this one too: 291 and 289 spans in the memory runs, 288 and 325 in the disk runs were generated by the sender and never accepted by either gateway pod. A queue only holds what the Collector has received. The sender also generated fewer than 3,000 spans in 50 seconds in every run (2,272 to 2,576); the lab didn't measure why. I didn't test what covers that gap, such as a second gateway replica or retries in the sender.

The numbers

Run Sent by the app Accepted Queue at the delete Queue in the old pod's final read Brought back Arrived at the relay Accepted, never arrived
memory-1 2,402 2,111 1,073 16 0 907 1,204
memory-2 2,272 1,983 1,024 16 0 831 1,152
disk-1 2,344 2,056 992 1,120 1,120 2,056 0
disk-2 2,576 2,251 960 1,095 1,095 2,251 0

Both configs held a similar backlog at the delete.

The lab's own summary, from the AWS run:

run       rate/s generated  accepted    sent relay_unq relay_all q_before restored   ready_s acc_unsent  drain_s complete
memory-1    60.0      2402      2111     907      907      907      16       0        16      1204        7        1
memory-2    60.0      2272      1983     831      831      831      16       0        18      1152        9        1
disk-1      60.0      2344      2056    2056     2056     2056    1120    1120        17         0       10        1
disk-2      60.0      2576      2251    2251     2251     2251    1095    1095        14         0        7        1

Splunk APM, further down the line: 453 and 415 spans for the load service in the memory runs, 1,028 and 1,124 in the disk runs. In every run that's about half the relay's count, within 2 spans. The lab read the same count split by span kind, and both parts read 0, so it doesn't explain the factor of 2. As a relative check it agrees with the relay: disk-1 held 2.27 times as many spans as memory-1 in both counts. The program, per run window:

data('spans.count', filter=filter('sf_environment', '<lab name>') and filter('sf_service', 'checkout-load'), rollup='delta').sum().publish()

Lab summary of all four runs

Try it yourself

The disk config adds the extension and one line to the exporter:

extensions:
  file_storage:
    directory: /var/lib/otelcol/queue/${env:LAB_RUN}
    create_directory: true
exporters:
  otlphttp:
    endpoint: http://relay:4318
    retry_on_failure:
      max_interval: 5s
    sending_queue:
      storage: file_storage
      sizer: items
      queue_size: 100000
      batch:
        enabled: true
service:
  extensions: [file_storage]

In this lab, an init container hands the node directory to user and group 10001, the user the Collector runs as:

initContainers:
  - name: queue-dir
    image: public.ecr.aws/docker/library/busybox:1.36
    command: ["sh", "-c", "chown 10001:10001 /q && ls -lnd /q"]

The load:

telemetrygen traces --otlp-http --otlp-endpoint=gateway.demo.svc.cluster.local:4318 --otlp-insecure \
  --batch=false --workers=4 --rate=15 --duration=50s --service=checkout-load --allow-export-failures

Things to plan for:

Every script and the raw output of every run are in the lab folder.

Every file in this lab

Everything above runs from these files. Open any of them to copy it, or clone the repo as shown:

Sources

I work at Splunk, part of Cisco. Views are my own.

Read next

OpenTelemetry code owner for two Collector components. Writes hands-on AWS container guides, each tested in a lab. See the proof