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.
More on PromQL and recording rules
`rate(http_requests_total[1m])` returns nothing but `http_requests_total` has dataBeginner`rate()` applied to a gauge shows huge spikesBeginnerBinary operation fails: `many-to-many matching not allowed: matching labels must be unique on one side`Advanced`found duplicate series for the match group {pod="api-1"} on the right hand-side of the operation`IntermediateError ratio query returns no data during quiet hoursIntermediate`histogram_quantile` returns `NaN`Intermediate