Interview Prep/Monitoring & Observability/Prometheus scraping and targets

Remote write receiver (Mimir/Cortex/Thanos Receive) returns `out of order sample`

AdvancedTroubleshootingPrometheus scraping and targets
Answer

Likely causes → Two Prometheus replicas in an HA pair write identical series without dedup, or a replica restarted and replays old WAL data after newer samples were accepted.

Diagnose → Check the sender: prometheus_remote_storage_samples_failed_total and logs server returned HTTP status 400 Bad Request: ... out of order sample. Confirm both replicas have the same external_labels.

Fix → Give HA replicas external_labels: {cluster: prod, __replica__: a|b} and enable HA dedup in the receiver (Mimir: accept_ha_samples with ha_cluster_label/ha_replica_label). Or enable out-of-order ingestion on the receiver for a bounded window.

Prevent → Treat 400s as non-retryable data loss: alert on rate(prometheus_remote_storage_samples_failed_total[5m]) > 0.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus scraping and targets