Skip to content

Commit b41a4df

Browse files
committed
Skip results cache, if multi tenants query
Signed-off-by: Christian Simon <[email protected]>
1 parent 0667242 commit b41a4df

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/querier/queryrange/results_cache.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,17 @@ func NewResultsCacheMiddleware(
179179
}
180180

181181
func (s resultsCache) Do(ctx context.Context, r Request) (Response, error) {
182-
userID, err := tenant.TenantID(ctx)
182+
tenantIDs, err := tenant.TenantIDs(ctx)
183183
if err != nil {
184184
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
185185
}
186186

187+
// do not cache multi tenant queries
188+
if len(tenantIDs) != 1 {
189+
return s.next.Do(ctx, r)
190+
}
191+
userID := tenantIDs[0]
192+
187193
if s.shouldCache != nil && !s.shouldCache(r) {
188194
return s.next.Do(ctx, r)
189195
}

0 commit comments

Comments
 (0)