Prompt
How do I find the cause of duplicate or missing events?
Latest observation
Nov 17, 2026
OpenAI APIWeb search: off
To find the cause of duplicate or missing events, use a systematic approach:
1) Verify the source
- Check whether the events are already duplicated/missing at the origin (producer, app logs, sensor, database CDC, etc.).
- Compare the raw source records with what downstream systems received.
2) Check event IDs and timestamps
- Make sure each event has a unique ID.
- Compare:
- event creation time
- ingestion time
- processing time
- Look for replays, retries, clock skew, or out-of-order delivery.
3) Inspect the delivery path
Common causes include:
- Retries without idempotency → duplicates
- At-least-once delivery semantics → duplicates are expected unless deduplicated
- Consumer failures / offsets not committed → reprocessing duplicates
- Dropped messages due to timeouts, backpressure, queue overflow, or DLQ routing
- Filtering rules accidentally excluding events
4) Review logs and traces
- Search producer logs for:
- send failures
- retries
- batch flush issues
- Search consumer logs for:
- deserialization errors
- processing exceptions
- restart/crash loops
- checkpoint/offset commit failures
5) Compare counts at each stage
Track event counts from:
- source
- producer output
- broker/queue
- consumer input
- final destination
A mismatch tells you where events are being lost or duplicated.
6) Check deduplication and idempotency
- If duplicates appear, confirm whether downstream systems deduplicate by:
- event ID
- sequence number
- business key
- If missing events appear, verify whether valid duplicates are being incorrectly discarded.
7) Examine time windows and ordering
- Batch jobs and windowed aggregations can “miss” late-arriving events.
- Look for watermark settings, retention windows, and partitioning issues.
8) Test with controlled inputs
- Send a small set of known events with IDs.
- Trace them end-to-end.
- Introduce failures intentionally to see whether retries or crashes create duplicates/missing records.
9) Check infrastructure issues
- Broker outages, network drops, storage corruption, and autoscaling events can all contribute.
- Look at metrics like:
- queue depth
- consumer lag
- retry counts
- error rates
- dropped messages
10) Add better observability
For future diagnosis:
- Add correlation IDs
- Log event lifecycle stages
- Emit metrics for sent/received/processed counts
- Use distributed tracing if possible
If you want, I can turn this into a debugging checklist for a specific system like Kafka, RabbitMQ, SQS, webhooks, or event streams.