grafana / mimir

Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.
https://grafana.com/oss/mimir/
GNU Affero General Public License v3.0
4.07k stars 518 forks source link

per-tenant `max_total_query_length` not overriding global limit #7686

Closed alexanderldavis closed 4 months ago

alexanderldavis commented 6 months ago

Describe the bug

When trying to override the total query time range limit on a per-tenant basis, we continue to get the error

bad_data: the total query time range exceeds the limit (query length: 43848h0m0s, limit: 6144h0m0s) (err-mimir-max-total-query-length). To adjust the related per-tenant limit, configure -query-frontend.max-total-query-length, or contact your service administrator.

To Reproduce

Steps to reproduce the behavior:

  1. In our case, the global limit on the Mimir datasource is 256d (6144h0m0s):
mimir:
  structuredConfig:
    limits:
      max_total_query_length: 256d

and we are configuring the per-tenant override set to 10y:

runtimeConfig:
  overrides:
    specialTenant:
      max_total_query_length: 3650d
  1. When looking at the query frontend config that is deployed, we see the max_total_query_length override is being set correctly.
  2. Run a query over 5 years of data. The bad_data: the total query time range exceeds the limit will appear.

Expected behavior

max_total_query_length should be configurable on a per-tenant basis, so that certain tenants allow for longer query windows than the global limit.

Environment

On Grafana Mimir v2.10.x

Additional Context

rgroothuijsen commented 5 months ago

Overrides appear to work for me on the latest version. Two things to check would be if multitenancy is enabled in the Mimir configuration, and if the org ID is being passed in the request (the X-Scope-OrgID header). If multitenancy is disabled, tenant overrides are ignored.

dimitarvdimitrov commented 5 months ago

another thing to check - if multiple tenants are used for the query, then the lowest limit is enforced.

56quarters commented 4 months ago

I'm going to close this issue since we have tests demonstrating that per-tenant overrides work.