Interview Prep/Monitoring & Observability/PromQL and recording rules

A PromQL query in the UI returns `Empty query result` for a metric you can see on `/metrics`

BeginnerTroubleshootingPromQL and recording rules
Answer

Likely causes → The target is not actually scraped by this Prometheus, label values differ from what you typed (job="api" vs job="api-svc"), or the time range is before the target was added.

Diagnose →

up{job=~".*api.*"}
count by (job, instance) ({__name__="http_requests_total"})

Drop label matchers one at a time until results appear.

Fix → Use the real label values (autocomplete in Grafana Explore helps), or add the scrape job.

Prevent → Use label value variables in dashboards instead of hardcoded strings.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL and recording rules