Interview Prep/Monitoring & Observability/Prometheus scraping and targets

Scrape errors show `body size limit exceeded`

IntermediateTroubleshootingPrometheus scraping and targets
Answer

Likely causes → body_size_limit is set on the job and the exporter response grew past it, usually due to a new high-cardinality metric.

Diagnose →

curl -s http://app:8080/metrics | wc -c
curl -s http://app:8080/metrics | grep -v '^#' | cut -d'{' -f1 | sort | uniq -c | sort -rn | head

Fix → Remove the offending labels in the app, or drop them via metric_relabel_configs. Only raise the limit once the growth is understood.

Prevent → Keep body_size_limit and sample_limit on every job as a guardrail.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus scraping and targets