Skip to content

Commit

Permalink
fix(log results cache): include pipeline wrapper disabled in cache key (
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthgoli authored Jul 8, 2024
1 parent 1834065 commit 221491c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/querier/queryrange/log_result_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 221491c

Please sign in to comment.