From 1162a8bb08b6ecca2a9a1558afdf8dc87d113c26 Mon Sep 17 00:00:00 2001 From: Karsten Jeschkies Date: Thu, 26 Oct 2023 14:01:47 +0200 Subject: [PATCH] Remove `GetHeaders` from `logproto.VolumeResponse`. (#11049) **What this PR does / why we need it**: Replaces https://github.com/grafana/loki/pull/11048/. We would return `logproto.VolumeResponse` but not match it in the codec. **Special notes for your reviewer**: **Checklist** - [ ] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [ ] Documentation added - [ ] Tests updated - [ ] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [ ] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](https://github.com/grafana/loki/commit/d10549e3ece02120974929894ee333d07755d213) - [ ] If the change is deprecating or removing a configuration option, update the `deprecated-config.yaml` and `deleted-config.yaml` files respectively in the `tools/deprecated-config-checker` directory. (cherry picked from commit aedf6dfc217fb71df4e7c873b158319b0b6da27c) --- pkg/logproto/compat.go | 4 ---- pkg/querier/handler.go | 6 +++++- pkg/querier/queryrange/codec.go | 2 +- pkg/querier/queryrange/limits_test.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/logproto/compat.go b/pkg/logproto/compat.go index e294b9fcc914b..869355cf8ad71 100644 --- a/pkg/logproto/compat.go +++ b/pkg/logproto/compat.go @@ -323,7 +323,3 @@ func (m *VolumeRequest) LogToSpan(sp opentracing.Span) { otlog.String("end", timestamp.Time(m.GetEnd()).String()), ) } - -func (*VolumeResponse) GetHeaders() []*definitions.PrometheusResponseHeader { - return nil -} diff --git a/pkg/querier/handler.go b/pkg/querier/handler.go index 033776d461648..47a4c15e07511 100644 --- a/pkg/querier/handler.go +++ b/pkg/querier/handler.go @@ -94,7 +94,11 @@ func (h *Handler) Do(ctx context.Context, req queryrangebase.Request) (queryrang } return &queryrange.IndexStatsResponse{Response: result}, nil case *logproto.VolumeRequest: - return h.api.VolumeHandler(ctx, concrete) + result, err := h.api.VolumeHandler(ctx, concrete) + if err != nil { + return nil, err + } + return &queryrange.VolumeResponse{Response: result}, nil default: return nil, fmt.Errorf("unsupported query type %T", req) } diff --git a/pkg/querier/queryrange/codec.go b/pkg/querier/queryrange/codec.go index 208d65fa4276f..9f3da0894a0fe 100644 --- a/pkg/querier/queryrange/codec.go +++ b/pkg/querier/queryrange/codec.go @@ -1518,7 +1518,7 @@ func NewEmptyResponse(r queryrangebase.Request) (queryrangebase.Response, error) case *logproto.IndexStatsRequest: return &logproto.IndexStatsResponse{}, nil case *logproto.VolumeRequest: - return &logproto.VolumeResponse{}, nil + return &VolumeResponse{}, nil default: return nil, fmt.Errorf("unsupported request type %T", req) } diff --git a/pkg/querier/queryrange/limits_test.go b/pkg/querier/queryrange/limits_test.go index e1329f5ee8c0a..1b7fda92bde71 100644 --- a/pkg/querier/queryrange/limits_test.go +++ b/pkg/querier/queryrange/limits_test.go @@ -304,7 +304,7 @@ func Test_MaxQueryLookBack_Types(t *testing.T) { From: model.Time(now.UnixMilli()), Through: model.Time(now.Add(-90 * time.Minute).UnixMilli()), }, - expectedResponse: &logproto.VolumeResponse{}, + expectedResponse: &VolumeResponse{}, }, }