From 5b498eca6872f8318778c881afcee1f8b9b2a194 Mon Sep 17 00:00:00 2001 From: Ashwanth Goli Date: Wed, 26 Jun 2024 18:36:12 +0530 Subject: [PATCH] fix(log results cache): include pipeline wrapper disabled in cache key --- 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 {