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.
More on Prometheus scraping and targets
A target shows `DOWN` on `/targets` with `Get "http://10.0.3.14:9100/metrics": context deadline exceeded`BeginnerTarget is `DOWN` with `server returned HTTP status 401 Unauthorized`BeginnerTarget shows `server returned HTTP status 403 Forbidden` when scraping kubelet / cAdvisorIntermediateTarget is `DOWN` with `connect: connection refused`BeginnerTarget shows `x509: certificate signed by unknown authority`IntermediateTarget shows `x509: certificate is valid for app.svc, not 10.0.4.22`Intermediate