From 221491c123adb6cedfabace6fc2cd03a32124655 Mon Sep 17 00:00:00 2001 From: Ashwanth Date: Mon, 8 Jul 2024 11:16:57 +0530 Subject: [PATCH] fix(log results cache): include pipeline wrapper disabled in cache key (#13328) --- pkg/querier/queryrange/log_result_cache.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/querier/queryrange/log_result_cache.go b/pkg/querier/queryrange/log_result_cache.go index 4a74b71d8d76..da3dc58896a4 100644 --- a/pkg/querier/queryrange/log_result_cache.go +++ b/pkg/querier/queryrange/log_result_cache.go @@ -23,6 +23,7 @@ import ( "github.com/grafana/loki/v3/pkg/querier/queryrange/queryrangebase" "github.com/grafana/loki/v3/pkg/storage/chunk/cache" "github.com/grafana/loki/v3/pkg/util/constants" + "github.com/grafana/loki/v3/pkg/util/httpreq" "github.com/grafana/loki/v3/pkg/util/validation" ) @@ -124,6 +125,9 @@ func (l *logResultCache) Do(ctx context.Context, req queryrangebase.Request) (qu } cacheKey := fmt.Sprintf("log:%s:%s:%d:%d", tenant.JoinTenantIDs(transformedTenantIDs), req.GetQuery(), interval.Nanoseconds(), alignedStart.UnixNano()/(interval.Nanoseconds())) + if httpreq.ExtractHeader(ctx, httpreq.LokiDisablePipelineWrappersHeader) == "true" { + cacheKey = "pipeline-disabled:" + cacheKey + } _, buff, _, err := l.cache.Fetch(ctx, []string{cache.HashKey(cacheKey)}) if err != nil {