Querying Mimir with PromQL in Grafana lets dashboards and Explore read metrics from a Prometheus-compatible backend. Grafana uses the Prometheus data source type for Mimir because Mimir exposes the same query API shape.
The data source URL depends on where Grafana runs. A Grafana container in the same Compose network should use http://mimir:9009/prometheus, while a browser on the host can test the same backend through http://127.0.0.1:9009/prometheus when the port is published.
Run a query only after Prometheus or Alloy has written samples into Mimir. A successful API response with an empty result proves the query endpoint is reachable, but it does not prove that metrics are being ingested.
$ curl --silent 'http://127.0.0.1:9009/prometheus/api/v1/query?query=up'
{"status":"success","data":{"resultType":"vector","result":[]}}
http://mimir:9009/prometheus
Use the service name when Grafana and Mimir run in the same Compose network. Use the host-published URL only when Grafana itself can reach that host address.
up
up{cluster="lab", instance="127.0.0.1:9090", job="prometheus", replica="prometheus-01"} 1
up{cluster="lab", replica="prometheus-01"}
If up is empty, check remote write before changing Grafana.
Related: How to ingest Prometheus remote write data into Mimir
Panels, alerts, and recording rules should use stable external labels such as cluster or replica only when those labels are deliberately managed across Prometheus senders.