Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source RSS

Query metric data from Grafana Mimir

You can query data from Grafana Mimir via Grafana or the Grafana Mimir HTTP API.

The Grafana Mimir HTTP API is compatible with the Prometheus HTTP API.

To understand how you can query Prometheus data from within Mimir, refer to Querying Prometheus, which introduces you to Prometheus Query Language (PromQL).

Understand how range queries are cached

By default, Mimir caches a range query only if the query is aligned. A query is aligned when both the start and end parameters are multiples of its step.

Mathematically, it looks as follows:

start modulo step = 0

AND

end modulo step = 0

Otherwise, a query is unaligned and it is not cached.

If you are querying from within Grafana, queries are aligned for you automatically. If you invoke the Grafana Mimir HTTP API directly, make sure that your range queries are aligned in order to benefit from caching.

Caution

If you do want to cache unaligned queries, configure Mimir to enable caching on a per-tenant basis via the cache_unaligned_requests parameter. For more information, refer to limits.