Skip to content

Commit

Permalink
Set a header when we get a cache hit
Browse files Browse the repository at this point in the history
Signed-off-by: milesbryant <[email protected]>
  • Loading branch information
milesbxf committed Nov 15, 2024
1 parent 8a63bf3 commit f00612a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/cortex/querier/queryrange/results_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,15 @@ func (s resultsCache) handleHit(ctx context.Context, r Request, extents []Extent
}

response, err := s.merger.MergeResponse(r, responses...)
if err == nil {
if promResp, ok := response.(*PrometheusResponse); ok {
promResp.Headers = append(promResp.Headers, &PrometheusResponseHeader{
Name: "X-Thanos-Results-Cache",
Values: []string{fmt.Sprintf("hit; extents=%d", len(extents))},
})
}
}

return response, mergedExtents, err
}

Expand Down

0 comments on commit f00612a

Please sign in to comment.