Message queues
- Intake Collectors publish traces to Kafka. Independently scaled drain Collectors deliver the retained records to the backend.
Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.
- Two sets of Collectors work at different speeds. The intake writes traces to Kafka. The drain reads them later and delivers them to the backend, including traces retained during an outage.
- P0, P1 and P2 are partitions, each an ordered log. The drain workers form a consumer group. Its committed offset in each partition tells a replacement worker where to resume.
- If a worker delivers a trace and crashes before committing its offset, its replacement can send that trace again. A fourth worker also has no partition to read while all three already have owners in this group.
Reading
- Intake can keep appending during a backend outage while Kafka has capacity and its required replicas are available.
- Three partitions support up to three active partition owners in this drain group. Spread partitions and replicas across failure domains.
- Watch consumer lag, oldest unread record age and backend acceptance together. A healthy producer can coexist with a stalled drain.
Broker retention and export progress
Broker retention and export progress
Collector Contrib 0.136.0 · traces · illustrative topic settings
Choose who owns the backlog
| Choice | Durable state and recovery | Cost |
|---|---|---|
| Per-gateway file queue | The exporter queue survives a restart when the same gateway regains its intact volume. | Simple for one backend. Replacing a lost queue volume loses its unexported records. |
| Two Collector tiers with Kafka | Brokers retain trace records and a named drain group resumes from its committed offsets. Another group may read the retained history independently. | Requires broker capacity, replication, permissions, partition planning and retention monitoring. |
- Choose the broker boundary when independent replay, multiple destinations or a large outage window justifies operating it. One local queue is often enough for a short backend interruption.
- Give the producer identity write access to the trace topic. Grant each drain identity read access to the topic and its group. Isolate tenant data and retention policy at the broker and destination.
Configure matching signal, topic and encoding
- The two loopback configurations describe separate processes. Supply a Kafka cluster, the pre-created trace topic and a compatible OTLP backend to run the pair. Loopback transport settings belong to a local exercise.
- Both ends select traces on atlas.traces.v1 with otlp_proto. Use distinct topics and signal-specific pipelines for logs and metrics.
- The intake uses all in-sync acknowledgements. An illustrative three-broker deployment could choose replication factor three, minimum in-sync replicas two and unclean leader election disabled. Test producer errors when that minimum cannot be met.
- The fixture disables the intake sending queue. Its broker round trip is on the ingestion path. Adding a memory queue or batch processor changes the moment the intake returns success to its caller.
Intake Collector · OTLP to Kafkayaml
# Collector Contrib 0.136.0. Loopback demonstration for trace intake.
# Pre-create topic atlas.traces.v1 with the required replication and retention.
receivers:
otlp:
protocols:
grpc:
endpoint: 127.0.0.1:4317
exporters:
kafka/spans:
brokers: [127.0.0.1:9092]
traces:
topic: atlas.traces.v1
encoding: otlp_proto
producer:
required_acks: -1
allow_auto_topic_creation: false
sending_queue:
enabled: false
service:
telemetry:
metrics:
level: none
pipelines:
traces:
receivers: [otlp]
exporters: [kafka/spans]
What a committed offset proves
- Every drain replica uses the same group ID. A new group starts at earliest in this example. An existing group normally resumes its committed position while that offset remains valid.
- With message_marking.after enabled, the receiver can mark after the downstream consume call succeeds. Autocommit periodically commits those marks. Keep the drain pipeline synchronous for this example.
- Adding an asynchronous batch processor or memory sending queue can make that call succeed on local acceptance. A subsequent crash may lose the in-memory batch after the group has advanced.
- If the backend accepts the request and the worker crashes before the offset commit, a replacement may send the record again. Backend storage and Kafka group progress have independent commit boundaries.
- Refusing to mark a failing record can stall its partition. Alert on old unread records, classify invalid payloads and agree on a reviewed quarantine or skip procedure. A partial-success OTLP response can include rejected spans even when the RPC succeeds.
- Kafka group assignment distributes partitions. Tail sampling also requires spans of one trace to reach the same decision worker. Keying, stable partition mapping and rebalance handling matter if a stateful sampler is added.
Drain Collector · Kafka to OTLPyaml
# Collector Contrib 0.136.0. Use this as a second, independent process.
# The fixture backend must accept OTLP/gRPC on loopback port 14317.
receivers:
kafka/spans:
brokers: [127.0.0.1:9092]
group_id: atlas-trace-export
initial_offset: earliest
traces:
topic: atlas.traces.v1
encoding: otlp_proto
autocommit:
enable: true
interval: 1s
message_marking:
after: true
on_error: false
on_permanent_error: false
error_backoff:
enabled: true
initial_interval: 1s
max_interval: 10s
max_elapsed_time: 0s
exporters:
otlp/backend:
endpoint: 127.0.0.1:14317
tls:
insecure: true
sending_queue:
enabled: false
service:
telemetry:
metrics:
level: none
pipelines:
traces:
receivers: [kafka/spans]
exporters: [otlp/backend]
Size the outage window and catch-up rate
- At 4 MiB/s, a 30-minute outage adds 7,200 MiB of logical backlog. With three replicas, this corresponds to 21,600 MiB of replicated payload before compression and storage overhead.
- After recovery, suppose the backend sustains 10 MiB/s while new traffic stays at 4 MiB/s. The backlog drains at 6 MiB/s, taking about 20 minutes in this steady example. With drain capacity at or below 4 MiB/s, lag persists or grows.
- The fixture assumes four hours of time retention and a 24 GiB byte cap per partition. At an even split, four hours of new input is 19,200 MiB per partition. A hot partition can reach its size cap sooner. Retention cleanup acts on segments.
- Topic storage includes retained records already consumed. Provision the entire retention window plus replica, segment and operating headroom. Expired unread records cannot be reconstructed by rewinding an offset.
Outage and catch-up budgetjson
{
"units": "illustrative uncompressed MiB/s, steady rates, even partitions",
"newTrafficMiBps": 4,
"outageSeconds": 1800,
"recoveryTotalMiBps": 10,
"partitionCount": 3,
"replicationFactor": 3,
"topicPolicy": "delete",
"retentionMs": 14400000,
"retentionBytesPerPartition": 25769803776
}