Skip to content
LinkState
Go back

Minimal Telemetry Sets for Correlated Incident Replay

Introduction to Network Incident Replay

Accurate replay lets engineers reconstruct the exact sequence of control‑plane, data‑plane, and telemetry events that led to a service‑impacting condition. Without faithful replay, root‑cause analysis relies on inference and can miss transient interactions such as micro‑bursts that trigger queue drops only observable at sub‑second granularity.

A data‑first entry point is a timeline built from three correlated streams: interface counters, BGP state changes, and application‑level latency spikes. The following PromQL query returns a non‑zero vector when any of these signals changes in the last 5 minutes:

(
  increase(ifInOctets[5m]) 
  or 
  increase(bgpPeerStateChanges[5m]) 
  or 
  histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))
) 
> 0

If the vector is empty, the incident left no trace in these metrics, indicating a blind spot (e.g., micro‑burst loss not captured by 5‑minute counters).


Benefits of Combining Logs, Span Tags, and Event Topics

LayerWhat it adds to replayTypical blind spot if missing
LogsHuman‑readable context, error messages, config diffsInability to see why a span was tagged with an error code
Span tagsEnd‑to‑end latency, causality, retry loopsNo visibility into cross‑service timing or queuing delays
Event topicsPrecise ordering of asynchronous state changes; ability to re‑emit the exact streamLoss of sub‑second event ordering, making causality reconstruction guesswork

Together they provide immutable, timestamped records (logs), causal identifiers (span tags), and high‑volume, low‑latency state‑change notifications (event topics) that enable faithful reconstruction of network incidents.


Understanding Log Collection

Types of Logs for Incident Replay

Log typeSourceTypical fieldsReplay value
System/syslogRouter/switch OS, Linux hoststimestamp, hostname, facility, severity, msgDetects process restarts, kernel warnings, hardware errors
ApplicationContainers, microservices (Envoy, FRR, etc.)timestamp, trace_id, span_id, level, message, attributesCorrelates with spans via trace_id/span_id
AuditConfiguration management (NetConf, gNMI set)timestamp, user, session-id, target-path, old-value, new-valueShows who changed what and when
FlowNetFlow/IPFIX, sFlowtimestamp, srcIP, dstIP, srcPort, dstPort, protocol, bytes, packetsProvides data‑plane volume view missing from counters

Log Format and Structure Considerations

Log Collection Tools and Technologies

ToolIngestion methodOutputNotes
Fluent Bit / FluentdTail files, journald, systemd, gNMI telemetry (via exec)Loki, Elasticsearch, KafkaLightweight; supports multiline detection for stack traces
VectorSame sources as Fluent Bit, plus HTTP, KafkaLoki, Splunk, S3Built‑in remap language (VRL) for enrichment
PromtailFile tail, journald, systemd journalLokiOptimized for Loki label extraction; can add trace_id as label
gnmi‑targetSubscribe to gNMI streams, convert to JSONLoki/KafkaUseful for model‑driven telemetry arriving as structured updates
rsyslogTraditional syslog receptionLocal disk, remote forwardingMature but limited to line‑based parsing

Missing signal: Collecting only syslog without structured fields loses the ability to filter by trace_id or bgp.peer without costly regexes, increasing backend cardinality risk.


Span Tags and Distributed Tracing

Introduction to Span Tags and Distributed Tracing

A span represents a single unit of work (e.g., an RPC, a database query, a packet processing step). Span tags are key‑value pairs attached to a span that enrich it with contextual data (e.g., error=true, interface=eth0, bgp.prefix=10.0.0.0/24).

Data‑first entry point – a trace view showing latency breakdown for a failed BGP update:

Trace ID: a1b2c3d4e5f6
Span ID: 0x9f8e7d6c
Operation: bgp_update_send
Start: 2025-10-31T14:22:07.123456Z
Duration: 2.3ms
Tags:
  - peer=10.0.0.2
  - prefix=10.0.0.0/24
  - error=true
  - error.code=hold_timer_expired

The error=true tag appears on the span that actually transmitted the update, pinpointing where the hold‑timer expiration was detected. Without this tag, you would only see a generic latency spike.

Using Span Tags for Incident Replay

  1. Inject trace context into network‑device telemetry (e.g., gNMI subscriptions) using the OpenTelemetry SDK.
  2. Correlate each span’s trace_id with log lines containing the same identifier (added by the logging library).
  3. Replay by re‑executing the span tree in a trace visualizer (Jaeger, Tempo) while feeding the original log stream as overlay events.

Example: A gNMI subscription that streams interface counters can be annotated with a span:

// Pseudo‑Go using OpenTelemetry
ctx, span := tracer.Start(ctx, "gNMI_subscribe_interface")
defer span.End()
span.SetAttributes(
    attribute.String("interface", "eth0"),
    attribute.Int64("subscription_id", 42),
)
// inside the subscription loop:
for {
    resp, err := client.Subscribe(ctx, req)
    // record each response as an event
    span.AddEvent("gnmi_response",
        attribute.Int64("timestamp", time.Now().UnixNano()),
        attribute.String("json_val", string(resp.GetUpdate())))
    // ...
}

Each response becomes an event attached to the span, allowing you to replay the exact sequence of counter updates alongside logs that reference the same subscription_id.

ToolLanguage supportStorage backendKey features for network replay
JaegerGo, Java, Node.js, Python, .NETCassandra, Elasticsearch, KafkaUI with flamegraph; search by tags (error=true)
Tempo (Grafana)Go, Java, etc.Object storage (S3, GCS)Low‑cost; integrates directly with Loki logs via traceID label
ZipkinJava, Go, Node.js, PythonCassandra, MySQL, ElasticsearchSimple UI; supports custom tags via binary_annotations
OpenTelemetry SDKMulti‑languageExporter to any backendVendor‑agnostic instrumentation; can inject trace IDs into gNMI metadata
gNMI‑OTel bridge——Converts gNMI notifications into OTel spans with model‑derived tags (e.g., ifName, operStatus)

Missing signal: Capturing spans only at the application layer omits device‑level latency (e.g., ASIC pipeline stalls) visible in gNMI streams.


Event Topics and Messaging Systems

Introduction to Event Topics and Messaging Systems

An event topic is a named channel in a publish/subscribe system where producers emit immutable events and consumers receive them in order (or with configurable guarantees). For network incident replay, topics carry:

Because the messaging system preserves the exact byte payload and ordering (when configured for strong ordering), replaying the topic yields a bit‑for‑bit reconstruction of the original event stream.

Using Event Topics for Incident Replay

  1. Produce events directly from the source (e.g., a gNMI telemetry collector publishes each JSON update to a Kafka topic).
  2. Consume the topic during replay, feeding the events into a deterministic replay engine (e.g., a custom Go program that re‑applies config changes, updates a mock routing table, and emits synthetic logs/spans).
  3. Correlate each event’s timestamp with log entries and span timestamps to align the three streams.

Data‑first entry point – a Kafka consumer showing the exact sequence of events leading to a link flap:

$ kafka-console-consumer \
    --bootstrap-server kafka01:9092 \
    --topic network-events \
    --from-beginning \
    --property print.key=true \
    --property print.value=true \
    --max-messages 5

Output (reproduced lab output):

key:   ifOperStatus/eth0
value: {"timestamp":"2025-10-31T14:22:05.001Z","ifName":"eth0","oldState":"up","newState":"down","reason":"linkLoss"}
key:   bgpPeerStateChanged
value: {"timestamp":"2025-10-31T14:22:05.012Z","peer":"10.0.0.2","oldState":"Established","newState":"Idle","holdTimeExpired":true}
key:   telemetry/ifInOctets
value: {"timestamp":"2025-10-31T14:22:05.020Z","ifName":"eth0","value":0}
key:   log
value: {"timestamp":"2025-10-31T14:22:05.030Z","host":"router01","msg":"Link down on eth0, L1 loss detected"}
key:   span
value: {"traceID":"a1b2c3d4e5f6","spanID":"0x9f8e7d6c","name":"link_down_handling","timestamp":"2025-10-31T14:22:05.040Z","durationMs":1.2,"tags":{"interface":"eth0","error":true}}

The timestamps are strictly increasing (monotonic) and each event type appears in causal order: link loss → BGP state change → traffic drop → log entry → handling span. Missing or out‑of‑order events would cause the replay to diverge from the real incident.

SystemOrdering guaranteeTypical throughputSchema supportReplay suitability
Apache KafkaPer‑partition strict ordering>1 M msgs/secAvro, Protobuf, JSON SchemaExcellent – log‑compaction enables replay of latest state; replay via consumer groups
Apache PulsarPer‑key ordering (via key‑shared)~2 M msgs/secAvro, JSON, ProtobufGood – built‑in geo‑replication aids multi‑site replay
NATS JetStreamPer‑stream ordering (if max msgs=1)~1 M msgs/secNone (plain text)Viable for low‑volume streams; ordering guaranteed only when configured as such

End of document.


Share this post on:

Previous Post
Turning ad hoc probes into an incident playbook
Next Post
Semantic Snapshots for Reliable Post-Change Proof