Interview Prep/Monitoring & Observability/Prometheus scraping and targets

Prometheus logs `Error on ingesting out-of-order samples` with `num_dropped=...`

AdvancedTroubleshootingPrometheus scraping and targets
Answer

Likely causes → An exporter attaches its own timestamps that go backwards, two sources write the same series (duplicate targets or two remote-writers), or a pushed timestamp is older than the TSDB head allows.

Diagnose →

rate(prometheus_target_scrapes_sample_out_of_order_total[5m])
rate(prometheus_tsdb_out_of_order_samples_total[5m])

curl the target and look for explicit timestamps at the end of sample lines.

Fix → Remove explicit timestamps (or set honor_timestamps: false), dedupe targets, and give each writer a unique external label. If legitimate late data exists, enable storage.tsdb.out_of_order_time_window (e.g. 30m).

Prevent → One series, one writer. Alert on the counters above.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus scraping and targets