diff --git a/pkg/querier/queryrange/query_range.go b/pkg/querier/queryrange/query_range.go index 918950cfe3..1071dd95f8 100644 --- a/pkg/querier/queryrange/query_range.go +++ b/pkg/querier/queryrange/query_range.go @@ -87,6 +87,8 @@ type Request interface { // Response represents a query range response. type Response interface { proto.Message + // GetHeaders returns the HTTP headers in the response. + GetHeaders() []*PrometheusResponseHeader } type prometheusCodec struct{} diff --git a/pkg/querier/queryrange/results_cache.go b/pkg/querier/queryrange/results_cache.go index 8a99e66d88..9462d4574a 100644 --- a/pkg/querier/queryrange/results_cache.go +++ b/pkg/querier/queryrange/results_cache.go @@ -255,14 +255,12 @@ func (s resultsCache) shouldCacheResponse(ctx context.Context, r Response) bool } func getHeaderValuesWithName(r Response, headerName string) (headerValues []string) { - if promResp, ok := r.(*PrometheusResponse); ok { - for _, hv := range promResp.Headers { - if hv.GetName() != headerName { - continue - } - - headerValues = append(headerValues, hv.GetValues()...) + for _, hv := range r.GetHeaders() { + if hv.GetName() != headerName { + continue } + + headerValues = append(headerValues, hv.GetValues()...) } return