Infrastructure
OpenTelemetry Collector: validate the persistent export queue before recovery
A production runbook for checking storage, limits and duplicates after a backend outage before resuming telemetry export.
The observability backend is back, the Collector restarts and dashboards recover. Yet some incident traces are missing and others appear twice. A persistent queue was meant to protect pending telemetry, but a healthy restart proves neither that every item reached the queue nor that every batch arrived exactly once.
This runbook covers an OpenTelemetry gateway exporting OTLP traces to a temporarily unavailable backend. The goal is a controlled recovery with measured loss and duplication, not an unsupported exactly-once guarantee.
Preserve the recovery boundary
Identify the affected gateway and retain the image version, redacted effective configuration, instance ID, UTC window, export errors and queue metrics. Record the actual volume, its owner, free space and retention policy. Do not delete queue files to make the service look healthy.
Confirm that only one instance owns this queue storage and that the deployment reattaches the same volume on recovery. Ephemeral storage lost with a pod does not survive pod deletion. Do not share a queue directory across replicas without an explicit guarantee from the storage component and orchestrator.
If the backend is still unstable, use an isolated canary and freeze concurrent configuration changes. The queue may continue to grow: estimate time to saturation and notify the observability owners.
Find where data was lost
Compare counters and logs by instance, signal and exporter. Internal metric names and attributes depend on the Collector version and telemetry configuration; verify them against your deployment.
| Observation | Check | Implication |
|---|---|---|
| Enqueue failures | Full queue, unavailable storage or upstream pressure | Exporter retry cannot recover data that never entered the queue |
| Queue remains nonempty and sends fail | Backend, network, TLS or authentication | Preserve the queue and repair the cause |
| Queue is empty but IDs are missing downstream | Loss before enqueue, exhausted retries or permanent rejection | An empty queue is not proof of delivery |
| IDs repeat after recovery | Acknowledgement lost after acceptance or a repeated send | Measure duplicates using backend behavior |
Persistence protects items that actually entered the queue across certain restarts. It does not protect data lost before enqueue, lost or full disks, or batches discarded after retry limits are exhausted. Permanent failures can also be discarded without the same retries as transient failures.
Configure a queue you can test
This example shows the pattern using a distribution that includes file_storage and a compatible OTLP exporter. Component names and options depend on the version; validate against the exact binary before deployment. The directory must already be mounted, writable and protected as potentially sensitive data.
extensions:
file_storage/queue:
directory: /var/lib/otelcol/queue
exporters:
otlp/backend:
endpoint: telemetry.example.internal:4317
sending_queue:
storage: file_storage/queue
queue_size: 5000
retry_on_failure:
initial_interval: 5s
max_interval: 30s
max_elapsed_time: 10m
service:
extensions: [file_storage/queue]
pipelines:
traces:
receivers: [otlp]
exporters: [otlp/backend] The excerpt assumes an otlp receiver and TLS/authentication configuration defined elsewhere. Values are illustrative, not universal sizing guidance. Queue capacity uses the configured counting mode and version: do not confuse requests, items and bytes. Queued telemetry may contain sensitive attributes; encryption, permissions, backups and retention are properties of the chosen storage.
Context supplied by some authentication extensions may not survive persistence. Test the actual authentication path after restart, without storing tokens in incident evidence.
Size and exercise recovery
Under representative traffic, measure ingress and export rates, batch sizes, disk consumption and retry limits. With the backend completely unavailable, a first-order estimate is:
time to saturation ≈ free queue capacity / incoming rate
Use the same unit for both terms. Disk exhaustion and retry expiry are independent constraints; whichever is reached first bounds protection. Once the backend returns, backlog drains only when sustained export throughput exceeds ingress. Approximate drain time as backlog divided by that throughput difference, again in matching units. Leave headroom for bursts and changing batch sizes.
In an isolated environment, emit synthetic traces with known identifiers, then:
- Disconnect the test backend and confirm queue growth without enqueue failures.
- Restart the Collector with the same volume, identity and compatible configuration; verify queue recovery.
- Restore the backend and measure queue decline, delay and failures until stable.
- Compare emitted and received IDs, counting both missing and duplicate records. Separately restart during an export whose acknowledgement is uncertain.
- Exercise low disk space, a full queue, an outage longer than retry duration and a permanent rejection. Do not induce these conditions on the production volume.
A passing test proves only the scenario and versions exercised. Exported traces are not a transaction ledger; check how duplicates affect backend alerts and aggregations.
Resume, hold or roll back
Resume traffic progressively when the expected volume is mounted, identity and backend access work, the queue drains under load, and measured loss and duplication remain within the team’s limits. Monitor queue capacity, free disk, send failures and enqueue failures, preferably through an alert path independent of the telemetry pipeline.
Stop expansion if backlog keeps growing, storage approaches its limit or sentinel IDs are missing. Return to the last qualified image and configuration only after checking compatibility with the existing queue. Preserve the volume and evidence; do not blindly delete or migrate the queue. If compatibility is uncertain, isolate the instance and plan a controlled recovery. Rolling back configuration cannot restore telemetry already lost.