From 3cb0b1306f179144cd311a663059429f232e3d78 Mon Sep 17 00:00:00 2001 From: arnikola Date: Tue, 10 Dec 2019 16:39:31 -0500 Subject: [PATCH] [query] Cleaning up nits from #2049 and #2055 (#2056) --- .../query_fanout/restrict.go | 46 +-- src/query/api/v1/handler/graphite/find.go | 2 +- src/query/api/v1/handler/graphite/render.go | 2 +- .../handler/prometheus/native/common_test.go | 2 +- .../v1/handler/prometheus/native/list_tags.go | 2 +- .../api/v1/handler/prometheus/native/read.go | 3 +- .../prometheus/native/read_instantaneous.go | 3 +- .../api/v1/handler/prometheus/remote/match.go | 5 +- src/query/api/v1/httpd/handler.go | 26 +- src/query/block/container.go | 2 +- src/query/generated/proto/rpcpb/query.pb.go | 316 +++++++++--------- src/query/generated/proto/rpcpb/query.proto | 8 +- src/query/storage/converter.go | 38 +-- src/query/storage/converter_test.go | 94 +----- src/query/storage/prom_converter.go | 43 +-- src/query/storage/prom_converter_test.go | 56 +++- src/query/tsdb/remote/codecs.go | 28 +- src/query/tsdb/remote/codecs_test.go | 32 +- 18 files changed, 329 insertions(+), 379 deletions(-) diff --git a/scripts/docker-integration-tests/query_fanout/restrict.go b/scripts/docker-integration-tests/query_fanout/restrict.go index 39527839a9..32b6a79a9d 100644 --- a/scripts/docker-integration-tests/query_fanout/restrict.go +++ b/scripts/docker-integration-tests/query_fanout/restrict.go @@ -36,6 +36,28 @@ import ( "github.com/stretchr/testify/require" ) +type tester struct{} + +// Ensure tester is a TestingT and set a global `t`. +var t require.TestingT = &tester{} + +var ( + // name is global and set on startup. + name string + // clusters are constant, set by the test harness. + clusters = []string{"coordinator-cluster-a", "coordinator-cluster-b"} +) + +func (t *tester) Errorf(format string, args ...interface{}) { + _, fn, line, _ := runtime.Caller(4) + args[2] = fmt.Sprintf(" at %s:%d:\n%v", fn, line, args[2]) + fmt.Printf(format, args...) +} + +func (t *tester) FailNow() { + os.Exit(1) +} + func main() { var ts int flag.IntVar(&ts, "t", -1, "metric name to search") @@ -93,24 +115,6 @@ func mustMatcher(t models.MatchType, n string, v string) models.Matcher { return m } -type tester struct{} - -// Ensure tester is a TestingT and set a global `t`. -var t require.TestingT = &tester{} - -// name is global and set on startup. -var name string - -func (t *tester) Errorf(format string, args ...interface{}) { - _, fn, line, _ := runtime.Caller(4) - args[2] = fmt.Sprintf(" at %s:%d:\n%v", fn, line, args[2]) - fmt.Printf(format, args...) -} - -func (t *tester) FailNow() { - os.Exit(1) -} - func mustParseOpts(o handler.StringTagOptions) string { m, err := json.Marshal(o) require.NoError(t, err, "cannot marshal to json") @@ -124,13 +128,12 @@ func bothClusterDefaultStrip(url string) { }, }) - resp, err := queryWithHeader(url, string(m)) + resp, err := queryWithHeader(url, m) require.NoError(t, err, "failed to query") data := resp.Data.Result data.Sort() require.Equal(t, len(data), 2) - clusters := []string{"coordinator-cluster-a", "coordinator-cluster-b"} for i, d := range data { require.Equal(t, 2, len(d.Metric)) require.Equal(t, name, d.Metric["__name__"]) @@ -152,7 +155,6 @@ func bothClusterCustomStrip(url string) { data := resp.Data.Result data.Sort() require.Equal(t, len(data), 2) - clusters := []string{"coordinator-cluster-a", "coordinator-cluster-b"} for i, d := range data { require.Equal(t, 2, len(d.Metric)) require.Equal(t, clusters[i], d.Metric["cluster"]) @@ -174,7 +176,6 @@ func bothClusterNoStrip(url string) { data := resp.Data.Result data.Sort() require.Equal(t, len(data), 2) - clusters := []string{"coordinator-cluster-a", "coordinator-cluster-b"} for i, d := range data { require.Equal(t, 3, len(d.Metric)) require.Equal(t, name, d.Metric["__name__"]) @@ -197,7 +198,6 @@ func bothClusterMultiStrip(url string) { data := resp.Data.Result data.Sort() require.Equal(t, len(data), 2) - clusters := []string{"coordinator-cluster-a", "coordinator-cluster-b"} for i, d := range data { require.Equal(t, 1, len(d.Metric)) require.Equal(t, clusters[i], d.Metric["cluster"]) diff --git a/src/query/api/v1/handler/graphite/find.go b/src/query/api/v1/handler/graphite/find.go index 140ae17da5..3bb97ff722 100644 --- a/src/query/api/v1/handler/graphite/find.go +++ b/src/query/api/v1/handler/graphite/find.go @@ -43,7 +43,7 @@ const ( ) var ( - // FindHTTPMethods is the HTTP methods used with this resource. + // FindHTTPMethods are the HTTP methods for this handler. FindHTTPMethods = []string{http.MethodGet, http.MethodPost} ) diff --git a/src/query/api/v1/handler/graphite/render.go b/src/query/api/v1/handler/graphite/render.go index 84bfe10369..4c2c6ea640 100644 --- a/src/query/api/v1/handler/graphite/render.go +++ b/src/query/api/v1/handler/graphite/render.go @@ -48,7 +48,7 @@ const ( ) var ( - // ReadHTTPMethods is the HTTP methods used with this resource. + // ReadHTTPMethods are the HTTP methods used with this resource. ReadHTTPMethods = []string{http.MethodGet, http.MethodPost} ) diff --git a/src/query/api/v1/handler/prometheus/native/common_test.go b/src/query/api/v1/handler/prometheus/native/common_test.go index 40d8d64d14..15e37d53c6 100644 --- a/src/query/api/v1/handler/prometheus/native/common_test.go +++ b/src/query/api/v1/handler/prometheus/native/common_test.go @@ -93,7 +93,7 @@ func TestParamParsing_POST(t *testing.T) { req.Header.Add("Content-Type", "application/x-www-form-urlencoded") r, err := testParseParams(req) - require.Nil(t, err, "unable to parse request") + require.NoError(t, err, "unable to parse request") require.Equal(t, promQuery, r.Query) } diff --git a/src/query/api/v1/handler/prometheus/native/list_tags.go b/src/query/api/v1/handler/prometheus/native/list_tags.go index 1965c70268..1f6fa97313 100644 --- a/src/query/api/v1/handler/prometheus/native/list_tags.go +++ b/src/query/api/v1/handler/prometheus/native/list_tags.go @@ -43,7 +43,7 @@ const ( ) var ( - // ListTagsHTTPMethods are the HTTP methods used with this resource. + // ListTagsHTTPMethods are the HTTP methods for this handler. ListTagsHTTPMethods = []string{http.MethodGet, http.MethodPost} ) diff --git a/src/query/api/v1/handler/prometheus/native/read.go b/src/query/api/v1/handler/prometheus/native/read.go index 5f545f80f6..7bcb2e49d0 100644 --- a/src/query/api/v1/handler/prometheus/native/read.go +++ b/src/query/api/v1/handler/prometheus/native/read.go @@ -54,8 +54,7 @@ const ( ) var ( - // PromReadHTTPMethods is the valid HTTP methods used with this - // resource. + // PromReadHTTPMethods are the HTTP methods for this handler. PromReadHTTPMethods = []string{ http.MethodGet, http.MethodPost, diff --git a/src/query/api/v1/handler/prometheus/native/read_instantaneous.go b/src/query/api/v1/handler/prometheus/native/read_instantaneous.go index 4162e74426..913242ea37 100644 --- a/src/query/api/v1/handler/prometheus/native/read_instantaneous.go +++ b/src/query/api/v1/handler/prometheus/native/read_instantaneous.go @@ -43,8 +43,7 @@ const ( ) var ( - // PromReadInstantHTTPMethods is the valid HTTP methods used with this - // resource. + // PromReadInstantHTTPMethods are the HTTP methods for this handler. PromReadInstantHTTPMethods = []string{ http.MethodGet, http.MethodPost, diff --git a/src/query/api/v1/handler/prometheus/remote/match.go b/src/query/api/v1/handler/prometheus/remote/match.go index 5b9365f44d..64ded812ed 100644 --- a/src/query/api/v1/handler/prometheus/remote/match.go +++ b/src/query/api/v1/handler/prometheus/remote/match.go @@ -42,11 +42,12 @@ const ( ) var ( - // PromSeriesMatchHTTPMethods are the HTTP methods used with this resource. + // PromSeriesMatchHTTPMethods are the HTTP methods for this handler. PromSeriesMatchHTTPMethods = []string{http.MethodGet, http.MethodPost} ) -// PromSeriesMatchHandler represents a handler for prometheus series matcher endpoint. +// PromSeriesMatchHandler represents a handler for +// the prometheus series matcher endpoint. type PromSeriesMatchHandler struct { storage storage.Storage tagOptions models.TagOptions diff --git a/src/query/api/v1/httpd/handler.go b/src/query/api/v1/httpd/handler.go index 6ad9948c54..4718fab04d 100644 --- a/src/query/api/v1/httpd/handler.go +++ b/src/query/api/v1/httpd/handler.go @@ -260,12 +260,10 @@ func (h *Handler) RegisterRoutes() error { ).Methods(remote.TagValuesHTTPMethod) // List tag endpoints - for _, method := range native.ListTagsHTTPMethods { - h.router.HandleFunc(native.ListTagsURL, - wrapped(native.NewListTagsHandler(h.storage, h.fetchOptionsBuilder, - nowFn, h.instrumentOpts)).ServeHTTP, - ).Methods(method) - } + h.router.HandleFunc(native.ListTagsURL, + wrapped(native.NewListTagsHandler(h.storage, h.fetchOptionsBuilder, + nowFn, h.instrumentOpts)).ServeHTTP, + ).Methods(native.ListTagsHTTPMethods...) // Query parse endpoints h.router.HandleFunc(native.PromParseURL, @@ -276,18 +274,16 @@ func (h *Handler) RegisterRoutes() error { ).Methods(native.PromThresholdHTTPMethod) // Series match endpoints - for _, method := range remote.PromSeriesMatchHTTPMethods { - h.router.HandleFunc(remote.PromSeriesMatchURL, - wrapped(remote.NewPromSeriesMatchHandler(h.storage, - h.tagOptions, h.fetchOptionsBuilder, h.instrumentOpts)).ServeHTTP, - ).Methods(method) - } + h.router.HandleFunc(remote.PromSeriesMatchURL, + wrapped(remote.NewPromSeriesMatchHandler(h.storage, + h.tagOptions, h.fetchOptionsBuilder, h.instrumentOpts)).ServeHTTP, + ).Methods(remote.PromSeriesMatchHTTPMethods...) // Debug endpoints h.router.HandleFunc(validator.PromDebugURL, - wrapped(validator.NewPromDebugHandler(nativePromReadHandler, - h.fetchOptionsBuilder, *h.config.LookbackDuration, h.instrumentOpts)).ServeHTTP, - ).Methods(validator.PromDebugHTTPMethod) + wrapped(validator.NewPromDebugHandler( + nativePromReadHandler, h.fetchOptionsBuilder, *h.config.LookbackDuration, + h.instrumentOpts)).ServeHTTP).Methods(validator.PromDebugHTTPMethod) // Graphite endpoints h.router.HandleFunc(graphite.ReadURL, diff --git a/src/query/block/container.go b/src/query/block/container.go index 9ea2b748f5..af85a78403 100644 --- a/src/query/block/container.go +++ b/src/query/block/container.go @@ -626,7 +626,7 @@ func (b *ucContainerBlock) MultiSeriesIter( batch, err := bl.MultiSeriesIter(concurrency) if err != nil { // NB: do not have to set the iterator error here, since not all - // contained blocks necessarily allow mutli series iteration. + // contained blocks necessarily allow multi series iteration. return nil, err } diff --git a/src/query/generated/proto/rpcpb/query.pb.go b/src/query/generated/proto/rpcpb/query.pb.go index ae904e0ef8..f544759dbe 100644 --- a/src/query/generated/proto/rpcpb/query.pb.go +++ b/src/query/generated/proto/rpcpb/query.pb.go @@ -35,8 +35,8 @@ TagMatcher FetchOptions RestrictQueryOptions - RestrictFetchType - RestrictFetchTags + RestrictQueryType + RestrictQueryTags FetchResponse Series SeriesMetadata @@ -459,8 +459,8 @@ func (m *FetchOptions) GetIncludeResolution() bool { } type RestrictQueryOptions struct { - RestrictFetchType *RestrictFetchType `protobuf:"bytes,3,opt,name=RestrictFetchType" json:"RestrictFetchType,omitempty"` - RestrictFetchTags *RestrictFetchTags `protobuf:"bytes,4,opt,name=RestrictFetchTags" json:"RestrictFetchTags,omitempty"` + RestrictQueryType *RestrictQueryType `protobuf:"bytes,3,opt,name=restrictQueryType" json:"restrictQueryType,omitempty"` + RestrictQueryTags *RestrictQueryTags `protobuf:"bytes,4,opt,name=restrictQueryTags" json:"restrictQueryTags,omitempty"` } func (m *RestrictQueryOptions) Reset() { *m = RestrictQueryOptions{} } @@ -468,62 +468,62 @@ func (m *RestrictQueryOptions) String() string { return proto.Compact func (*RestrictQueryOptions) ProtoMessage() {} func (*RestrictQueryOptions) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{6} } -func (m *RestrictQueryOptions) GetRestrictFetchType() *RestrictFetchType { +func (m *RestrictQueryOptions) GetRestrictQueryType() *RestrictQueryType { if m != nil { - return m.RestrictFetchType + return m.RestrictQueryType } return nil } -func (m *RestrictQueryOptions) GetRestrictFetchTags() *RestrictFetchTags { +func (m *RestrictQueryOptions) GetRestrictQueryTags() *RestrictQueryTags { if m != nil { - return m.RestrictFetchTags + return m.RestrictQueryTags } return nil } -type RestrictFetchType struct { +type RestrictQueryType struct { MetricsType MetricsType `protobuf:"varint,1,opt,name=metricsType,proto3,enum=rpc.MetricsType" json:"metricsType,omitempty"` MetricsStoragePolicy *policypb.StoragePolicy `protobuf:"bytes,2,opt,name=metricsStoragePolicy" json:"metricsStoragePolicy,omitempty"` } -func (m *RestrictFetchType) Reset() { *m = RestrictFetchType{} } -func (m *RestrictFetchType) String() string { return proto.CompactTextString(m) } -func (*RestrictFetchType) ProtoMessage() {} -func (*RestrictFetchType) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{7} } +func (m *RestrictQueryType) Reset() { *m = RestrictQueryType{} } +func (m *RestrictQueryType) String() string { return proto.CompactTextString(m) } +func (*RestrictQueryType) ProtoMessage() {} +func (*RestrictQueryType) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{7} } -func (m *RestrictFetchType) GetMetricsType() MetricsType { +func (m *RestrictQueryType) GetMetricsType() MetricsType { if m != nil { return m.MetricsType } return MetricsType_UNKNOWN_METRICS_TYPE } -func (m *RestrictFetchType) GetMetricsStoragePolicy() *policypb.StoragePolicy { +func (m *RestrictQueryType) GetMetricsStoragePolicy() *policypb.StoragePolicy { if m != nil { return m.MetricsStoragePolicy } return nil } -type RestrictFetchTags struct { +type RestrictQueryTags struct { Restrict *TagMatchers `protobuf:"bytes,1,opt,name=restrict" json:"restrict,omitempty"` Strip [][]byte `protobuf:"bytes,2,rep,name=strip" json:"strip,omitempty"` } -func (m *RestrictFetchTags) Reset() { *m = RestrictFetchTags{} } -func (m *RestrictFetchTags) String() string { return proto.CompactTextString(m) } -func (*RestrictFetchTags) ProtoMessage() {} -func (*RestrictFetchTags) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{8} } +func (m *RestrictQueryTags) Reset() { *m = RestrictQueryTags{} } +func (m *RestrictQueryTags) String() string { return proto.CompactTextString(m) } +func (*RestrictQueryTags) ProtoMessage() {} +func (*RestrictQueryTags) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{8} } -func (m *RestrictFetchTags) GetRestrict() *TagMatchers { +func (m *RestrictQueryTags) GetRestrict() *TagMatchers { if m != nil { return m.Restrict } return nil } -func (m *RestrictFetchTags) GetStrip() [][]byte { +func (m *RestrictQueryTags) GetStrip() [][]byte { if m != nil { return m.Strip } @@ -1619,8 +1619,8 @@ func init() { proto.RegisterType((*TagMatcher)(nil), "rpc.TagMatcher") proto.RegisterType((*FetchOptions)(nil), "rpc.FetchOptions") proto.RegisterType((*RestrictQueryOptions)(nil), "rpc.RestrictQueryOptions") - proto.RegisterType((*RestrictFetchType)(nil), "rpc.RestrictFetchType") - proto.RegisterType((*RestrictFetchTags)(nil), "rpc.RestrictFetchTags") + proto.RegisterType((*RestrictQueryType)(nil), "rpc.RestrictQueryType") + proto.RegisterType((*RestrictQueryTags)(nil), "rpc.RestrictQueryTags") proto.RegisterType((*FetchResponse)(nil), "rpc.FetchResponse") proto.RegisterType((*Series)(nil), "rpc.Series") proto.RegisterType((*SeriesMetadata)(nil), "rpc.SeriesMetadata") @@ -2153,21 +2153,21 @@ func (m *RestrictQueryOptions) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.RestrictFetchType != nil { + if m.RestrictQueryType != nil { dAtA[i] = 0x1a i++ - i = encodeVarintQuery(dAtA, i, uint64(m.RestrictFetchType.Size())) - n5, err := m.RestrictFetchType.MarshalTo(dAtA[i:]) + i = encodeVarintQuery(dAtA, i, uint64(m.RestrictQueryType.Size())) + n5, err := m.RestrictQueryType.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n5 } - if m.RestrictFetchTags != nil { + if m.RestrictQueryTags != nil { dAtA[i] = 0x22 i++ - i = encodeVarintQuery(dAtA, i, uint64(m.RestrictFetchTags.Size())) - n6, err := m.RestrictFetchTags.MarshalTo(dAtA[i:]) + i = encodeVarintQuery(dAtA, i, uint64(m.RestrictQueryTags.Size())) + n6, err := m.RestrictQueryTags.MarshalTo(dAtA[i:]) if err != nil { return 0, err } @@ -2176,7 +2176,7 @@ func (m *RestrictQueryOptions) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *RestrictFetchType) Marshal() (dAtA []byte, err error) { +func (m *RestrictQueryType) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -2186,7 +2186,7 @@ func (m *RestrictFetchType) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RestrictFetchType) MarshalTo(dAtA []byte) (int, error) { +func (m *RestrictQueryType) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -2209,7 +2209,7 @@ func (m *RestrictFetchType) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *RestrictFetchTags) Marshal() (dAtA []byte, err error) { +func (m *RestrictQueryTags) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -2219,7 +2219,7 @@ func (m *RestrictFetchTags) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RestrictFetchTags) MarshalTo(dAtA []byte) (int, error) { +func (m *RestrictQueryTags) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -3326,18 +3326,18 @@ func (m *FetchOptions) Size() (n int) { func (m *RestrictQueryOptions) Size() (n int) { var l int _ = l - if m.RestrictFetchType != nil { - l = m.RestrictFetchType.Size() + if m.RestrictQueryType != nil { + l = m.RestrictQueryType.Size() n += 1 + l + sovQuery(uint64(l)) } - if m.RestrictFetchTags != nil { - l = m.RestrictFetchTags.Size() + if m.RestrictQueryTags != nil { + l = m.RestrictQueryTags.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *RestrictFetchType) Size() (n int) { +func (m *RestrictQueryType) Size() (n int) { var l int _ = l if m.MetricsType != 0 { @@ -3350,7 +3350,7 @@ func (m *RestrictFetchType) Size() (n int) { return n } -func (m *RestrictFetchTags) Size() (n int) { +func (m *RestrictQueryTags) Size() (n int) { var l int _ = l if m.Restrict != nil { @@ -4557,7 +4557,7 @@ func (m *RestrictQueryOptions) Unmarshal(dAtA []byte) error { switch fieldNum { case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RestrictFetchType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RestrictQueryType", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4581,16 +4581,16 @@ func (m *RestrictQueryOptions) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.RestrictFetchType == nil { - m.RestrictFetchType = &RestrictFetchType{} + if m.RestrictQueryType == nil { + m.RestrictQueryType = &RestrictQueryType{} } - if err := m.RestrictFetchType.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RestrictQueryType.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RestrictFetchTags", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RestrictQueryTags", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4614,10 +4614,10 @@ func (m *RestrictQueryOptions) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.RestrictFetchTags == nil { - m.RestrictFetchTags = &RestrictFetchTags{} + if m.RestrictQueryTags == nil { + m.RestrictQueryTags = &RestrictQueryTags{} } - if err := m.RestrictFetchTags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RestrictQueryTags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4642,7 +4642,7 @@ func (m *RestrictQueryOptions) Unmarshal(dAtA []byte) error { } return nil } -func (m *RestrictFetchType) Unmarshal(dAtA []byte) error { +func (m *RestrictQueryType) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4665,10 +4665,10 @@ func (m *RestrictFetchType) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RestrictFetchType: wiretype end group for non-group") + return fmt.Errorf("proto: RestrictQueryType: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RestrictFetchType: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RestrictQueryType: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4744,7 +4744,7 @@ func (m *RestrictFetchType) Unmarshal(dAtA []byte) error { } return nil } -func (m *RestrictFetchTags) Unmarshal(dAtA []byte) error { +func (m *RestrictQueryTags) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4767,10 +4767,10 @@ func (m *RestrictFetchTags) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RestrictFetchTags: wiretype end group for non-group") + return fmt.Errorf("proto: RestrictQueryTags: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RestrictFetchTags: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RestrictQueryTags: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7769,108 +7769,108 @@ func init() { } var fileDescriptorQuery = []byte{ - // 1640 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xdb, 0x72, 0xdb, 0x4e, - 0x19, 0xb7, 0xac, 0xf8, 0xf4, 0xf9, 0x10, 0x67, 0x13, 0xfe, 0x75, 0x42, 0x09, 0x1e, 0x01, 0x7f, - 0x42, 0x5a, 0xe2, 0xd6, 0x69, 0x29, 0x65, 0x86, 0x83, 0x13, 0xbb, 0x49, 0xa6, 0x89, 0x9d, 0xae, - 0x15, 0x5a, 0x18, 0x98, 0xb0, 0x96, 0xb7, 0x8e, 0x26, 0xd6, 0xa1, 0x92, 0x5c, 0x9a, 0x0e, 0x0f, - 0xc1, 0x30, 0x3c, 0x01, 0x0c, 0x3c, 0x41, 0x1f, 0x81, 0x0b, 0x2e, 0x79, 0x04, 0xa6, 0x70, 0xc1, - 0x63, 0x30, 0xbb, 0x5a, 0x9d, 0x2c, 0x65, 0xda, 0xe9, 0x9d, 0xbf, 0xf3, 0x7e, 0xdf, 0xfe, 0xf6, - 0xb7, 0x2b, 0xc3, 0xcf, 0x66, 0xba, 0x77, 0xb5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xfe, 0x0f, 0x24, 0xb4, 0xcf, 0x5e, - 0xb8, 0x8c, 0xae, 0x45, 0x91, 0xc4, 0x85, 0xbb, 0xb5, 0x9e, 0xd0, 0x85, 0x41, 0x03, 0xa8, 0xc5, - 0x3b, 0x42, 0xad, 0xdb, 0x78, 0x61, 0x6b, 0x33, 0xc3, 0x12, 0xa4, 0x39, 0xb8, 0xf3, 0xcf, 0x8f, - 0xdb, 0xd2, 0xbf, 0x3e, 0x6e, 0x4b, 0xff, 0xfe, 0xb8, 0x2d, 0xfd, 0xf1, 0x3f, 0xdb, 0xb9, 0x5f, - 0x17, 0xf8, 0x5f, 0x1d, 0x93, 0x22, 0xff, 0x6b, 0x62, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x66, 0x87, 0x8b, 0xa9, 0x27, 0x11, 0x00, 0x00, + // 1644 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xdb, 0x72, 0x1b, 0x49, + 0x19, 0xd6, 0x68, 0xac, 0xd3, 0xaf, 0x83, 0xe5, 0xb6, 0xd9, 0xc8, 0x26, 0x18, 0xd5, 0x00, 0x8b, + 0xf1, 0x06, 0x2b, 0x91, 0xb3, 0x2c, 0x4b, 0x15, 0x07, 0xd9, 0x52, 0x6c, 0xd7, 0xda, 0x92, 0xb7, + 0x35, 0x26, 0x81, 0x82, 0x32, 0xad, 0x51, 0x67, 0x3c, 0x65, 0xcd, 0x61, 0x67, 0x46, 0x4b, 0x9c, + 0xe2, 0x21, 0x28, 0x8a, 0x27, 0x80, 0x82, 0x27, 0xc8, 0x23, 0x70, 0xc1, 0x25, 0x8f, 0x40, 0x05, + 0x2e, 0x78, 0x0c, 0xaa, 0x7b, 0x7a, 0x4e, 0x9a, 0x71, 0x25, 0x95, 0xbb, 0xf9, 0xcf, 0xfd, 0xff, + 0xfd, 0xf5, 0xd7, 0x2d, 0xc1, 0x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x11, 0x54, 0xba, 0x2f, 0x28, 0xe1, 0x84, 0x8e, 0x61, 0x33, 0x96, 0x98, 0xdd, + 0x34, 0x5e, 0xd3, 0x79, 0xa7, 0x7c, 0x5f, 0x6c, 0x9e, 0x37, 0x83, 0xab, 0x61, 0x69, 0x8b, 0xe5, + 0x9c, 0x62, 0xea, 0xd9, 0x8b, 0x25, 0xef, 0xad, 0xd2, 0x95, 0xf6, 0xaa, 0x38, 0x6b, 0x50, 0xfe, + 0x22, 0xc1, 0x56, 0xde, 0xac, 0xd0, 0x10, 0x36, 0xdc, 0xa4, 0x5e, 0x0d, 0xb7, 0xac, 0xde, 0xff, + 0x28, 0x3b, 0x61, 0xbe, 0x71, 0xd9, 0x80, 0x6c, 0x16, 0xa2, 0x87, 0x40, 0xcd, 0xcb, 0x42, 0x74, + 0x0f, 0x67, 0x03, 0x94, 0x3f, 0x4b, 0xb0, 0x91, 0x29, 0x87, 0xfa, 0x50, 0x17, 0x9c, 0xc0, 0xd7, + 0x26, 0x25, 0xe1, 0x14, 0xeb, 0x71, 0xd2, 0x09, 0x7d, 0x01, 0x5b, 0x42, 0x9c, 0xfa, 0xb6, 0x4b, + 0x74, 0x7a, 0xc9, 0x49, 0x43, 0x40, 0xe7, 0xc1, 0x41, 0x48, 0x26, 0x07, 0x29, 0x33, 0xce, 0x0d, + 0x52, 0x9e, 0xaf, 0xae, 0x8a, 0xe8, 0x1e, 0x7a, 0x94, 0x00, 0xa4, 0x94, 0x7f, 0x86, 0x13, 0x38, + 0xe4, 0xe4, 0xe0, 0x1a, 0x4e, 0xa7, 0xd8, 0x95, 0xd9, 0x09, 0xe1, 0x82, 0xf2, 0x5b, 0x68, 0x0a, + 0x0a, 0x11, 0x54, 0xf5, 0x1d, 0x28, 0x7b, 0xd4, 0x35, 0x68, 0x78, 0x30, 0xeb, 0x3c, 0xe5, 0x94, + 0xab, 0xb0, 0x30, 0xa1, 0xef, 0xc3, 0x9a, 0x49, 0x7d, 0x22, 0x7a, 0xd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02, 0xff, 0xc7, + 0x12, 0x3a, 0x64, 0x2f, 0x5c, 0x46, 0xd7, 0xa2, 0x48, 0xea, 0xc2, 0xdd, 0xd9, 0x4c, 0xe9, 0xa2, + 0xa0, 0x11, 0x34, 0x92, 0x1d, 0xa1, 0xce, 0x7d, 0xbc, 0xb0, 0xb3, 0x9d, 0x63, 0x09, 0xd3, 0x1c, + 0x3d, 0xf8, 0xe7, 0xdb, 0x5d, 0xe9, 0x5f, 0x6f, 0x77, 0xa5, 0x7f, 0xbf, 0xdd, 0x95, 0xfe, 0xf8, + 0x9f, 0xdd, 0xc2, 0xaf, 0x4b, 0xfc, 0xaf, 0x8e, 0x59, 0x99, 0xff, 0x35, 0x71, 0xf8, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xa3, 0x81, 0x48, 0xf7, 0x27, 0x11, 0x00, 0x00, } diff --git a/src/query/generated/proto/rpcpb/query.proto b/src/query/generated/proto/rpcpb/query.proto index a50a243762..3f875052a1 100644 --- a/src/query/generated/proto/rpcpb/query.proto +++ b/src/query/generated/proto/rpcpb/query.proto @@ -65,16 +65,16 @@ message FetchOptions { } message RestrictQueryOptions { - RestrictFetchType RestrictFetchType = 3; - RestrictFetchTags RestrictFetchTags = 4; + RestrictQueryType restrictQueryType = 3; + RestrictQueryTags restrictQueryTags = 4; } -message RestrictFetchType { +message RestrictQueryType { MetricsType metricsType = 1; policypb.StoragePolicy metricsStoragePolicy = 2; } -message RestrictFetchTags { +message RestrictQueryTags { TagMatchers restrict = 1; repeated bytes strip = 2; } diff --git a/src/query/storage/converter.go b/src/query/storage/converter.go index b572ba70ae..89a15b67c3 100644 --- a/src/query/storage/converter.go +++ b/src/query/storage/converter.go @@ -34,6 +34,7 @@ import ( "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/ts" xcost "github.com/m3db/m3/src/x/cost" + xerrors "github.com/m3db/m3/src/x/errors" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" ) @@ -313,45 +314,32 @@ func decompressConcurrently( metadata block.ResultMetadata, tagOptions models.TagOptions, ) (*FetchResult, error) { - seriesList := make([]*ts.Series, len(iters)) - errorCh := make(chan error, 1) - done := make(chan struct{}) - stopped := func() bool { - select { - case <-done: - return true - default: - return false - } - } + var ( + seriesList = make([]*ts.Series, len(iters)) + + wg sync.WaitGroup + multiErr xerrors.MultiError + mu sync.Mutex + ) - var wg sync.WaitGroup for i, iter := range iters { i, iter := i, iter wg.Add(1) readWorkerPool.Go(func() { defer wg.Done() - if stopped() { - return - } - series, err := iteratorToTsSeries(iter, enforcer, tagOptions) if err != nil { - // Return the first error that is encountered. - select { - case errorCh <- err: - close(done) - default: - } - return + mu.Lock() + multiErr = multiErr.Add(err) + mu.Unlock() } + seriesList[i] = series }) } wg.Wait() - close(errorCh) - if err := <-errorCh; err != nil { + if err := multiErr.LastError(); err != nil { return nil, err } diff --git a/src/query/storage/converter_test.go b/src/query/storage/converter_test.go index 27b1a8601f..1983e61c9c 100644 --- a/src/query/storage/converter_test.go +++ b/src/query/storage/converter_test.go @@ -35,8 +35,8 @@ import ( "github.com/m3db/m3/src/query/test/seriesiter" "github.com/m3db/m3/src/query/ts" xcost "github.com/m3db/m3/src/x/cost" - "github.com/m3db/m3/src/x/ident" xsync "github.com/m3db/m3/src/x/sync" + xtest "github.com/m3db/m3/src/x/test" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" @@ -110,7 +110,7 @@ func verifyExpandSeries( } func testExpandSeries(t *testing.T, ex bool, pools xsync.PooledWorkerPool) { - ctrl := gomock.NewController(t) + ctrl := xtest.NewController(t) for i := 0; i < 100; i++ { verifyExpandSeries(t, ctrl, i, ex, pools) @@ -138,92 +138,6 @@ func TestExpandSeriesSmallValidPools(t *testing.T) { testExpandSeries(t, true, pool) } -func TestFailingExpandSeriesValidPools(t *testing.T) { - var ( - numValidSeries = 8 - numValues = 2 - poolSize = 2 - numUncalled = 10 - ) - pool, err := xsync.NewPooledWorkerPool(poolSize, - xsync.NewPooledWorkerPoolOptions()) - require.NoError(t, err) - pool.Init() - ctrl := gomock.NewController(t) - - iters := seriesiter.NewMockSeriesIterSlice(ctrl, - seriesiter.NewMockValidTagGenerator(ctrl), numValidSeries, numValues) - // Add poolSize + 1 failing iterators; there can be slight timing - // inconsistencies which can sometimes cause failures in this test - // as one of the `uncalled` iterators gets unexpectedly used. - // This is not a big issue in practice, as all it means is one further - // iterator is expanded before erroring out. - for i := 0; i < poolSize+1; i++ { - invalidIter := encoding.NewMockSeriesIterator(ctrl) - invalidIter.EXPECT().ID().Return(ident.StringID("foo")).Times(1) - - tags := ident.NewMockTagIterator(ctrl) - tags.EXPECT().Next().Return(false).MaxTimes(1) - tags.EXPECT().Remaining().Return(0).MaxTimes(1) - tags.EXPECT().Err().Return(errors.New("error")).MaxTimes(1) - invalidIter.EXPECT().Tags().Return(tags).MaxTimes(1) - - iters = append(iters, invalidIter) - } - - for i := 0; i < numUncalled; i++ { - uncalledIter := encoding.NewMockSeriesIterator(ctrl) - iters = append(iters, uncalledIter) - } - - mockIters := encoding.NewMockSeriesIterators(ctrl) - mockIters.EXPECT().Iters().Return(iters).Times(1) - mockIters.EXPECT().Len().Return(len(iters)).Times(1) - mockIters.EXPECT().Close().Times(1) - enforcer := cost.NewMockChainedEnforcer(ctrl) - enforcer.EXPECT().Add(xcost.Cost(2)).Times(numValidSeries) - - result, err := SeriesIteratorsToFetchResult(mockIters, pool, true, - block.NewResultMetadata(), enforcer, nil) - require.Nil(t, result) - require.EqualError(t, err, "error") -} - -func TestOverLimit(t *testing.T) { - var ( - numValidSeries = 8 - numValues = 2 - poolSize = 2 - numUncalled = 10 - ) - pool, err := xsync.NewPooledWorkerPool(poolSize, - xsync.NewPooledWorkerPoolOptions()) - require.NoError(t, err) - pool.Init() - ctrl := gomock.NewController(t) - - iters := seriesiter.NewMockSeriesIterSlice(ctrl, - seriesiter.NewMockValidTagGenerator(ctrl), numValidSeries+poolSize+1, numValues) - for i := 0; i < numUncalled; i++ { - uncalledIter := encoding.NewMockSeriesIterator(ctrl) - iters = append(iters, uncalledIter) - } - - mockIters := encoding.NewMockSeriesIterators(ctrl) - mockIters.EXPECT().Iters().Return(iters).Times(1) - mockIters.EXPECT().Len().Return(len(iters)).Times(1) - mockIters.EXPECT().Close().Times(1) - enforcer := cost.NewMockChainedEnforcer(ctrl) - enforcer.EXPECT().Add(xcost.Cost(2)).Times(numValidSeries) - enforcer.EXPECT().Add(xcost.Cost(2)). - Return(xcost.Report{Error: errors.New("error")}).MinTimes(1) - - result, err := SeriesIteratorsToFetchResult(mockIters, pool, true, - block.NewResultMetadata(), enforcer, nil) - require.Nil(t, result) - require.EqualError(t, err, "error") -} - var ( name = []byte("foo") value = []byte("bar") @@ -325,7 +239,7 @@ var ( func TestIteratorToTsSeries(t *testing.T) { t.Run("errors on iterator error", func(t *testing.T) { - ctrl := gomock.NewController(t) + ctrl := xtest.NewController(t) mockIter := encoding.NewMockSeriesIterator(ctrl) expectedErr := errors.New("expected") @@ -343,7 +257,7 @@ func TestIteratorToTsSeries(t *testing.T) { } func TestFetchResultToPromResult(t *testing.T) { - ctrl := gomock.NewController(t) + ctrl := xtest.NewController(t) defer ctrl.Finish() now := time.Now() diff --git a/src/query/storage/prom_converter.go b/src/query/storage/prom_converter.go index 6a87bfdb4c..ecbae5abf2 100644 --- a/src/query/storage/prom_converter.go +++ b/src/query/storage/prom_converter.go @@ -29,10 +29,15 @@ import ( "github.com/m3db/m3/src/query/generated/proto/prompb" "github.com/m3db/m3/src/query/models" xcost "github.com/m3db/m3/src/x/cost" + xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" xsync "github.com/m3db/m3/src/x/sync" ) +func cloneBytes(b []byte) []byte { + return append(make([]byte, 0, len(b)), b...) +} + func tagIteratorToLabels( identTags ident.TagIterator, ) ([]prompb.Label, error) { @@ -40,8 +45,8 @@ func tagIteratorToLabels( for identTags.Next() { identTag := identTags.Current() labels = append(labels, prompb.Label{ - Name: identTag.Name.Bytes(), - Value: identTag.Value.Bytes(), + Name: cloneBytes(identTag.Name.Bytes()), + Value: cloneBytes(identTag.Value.Bytes()), }) } @@ -123,36 +128,23 @@ func toPromConcurrently( tagOptions models.TagOptions, ) (PromResult, error) { seriesList := make([]*prompb.TimeSeries, len(iters)) - errorCh := make(chan error, 1) - done := make(chan struct{}) - stopped := func() bool { - select { - case <-done: - return true - default: - return false - } - } - var wg sync.WaitGroup + var ( + wg sync.WaitGroup + multiErr xerrors.MultiError + mu sync.Mutex + ) + for i, iter := range iters { i, iter := i, iter wg.Add(1) readWorkerPool.Go(func() { defer wg.Done() - if stopped() { - return - } - series, err := iteratorToPromResult(iter, enforcer, tagOptions) if err != nil { - // Return the first error that is encountered. - select { - case errorCh <- err: - close(done) - default: - } - return + mu.Lock() + multiErr = multiErr.Add(err) + mu.Unlock() } seriesList[i] = series @@ -160,8 +152,7 @@ func toPromConcurrently( } wg.Wait() - close(errorCh) - if err := <-errorCh; err != nil { + if err := multiErr.LastError(); err != nil { return PromResult{}, err } diff --git a/src/query/storage/prom_converter_test.go b/src/query/storage/prom_converter_test.go index 9676cead26..ac92daa696 100644 --- a/src/query/storage/prom_converter_test.go +++ b/src/query/storage/prom_converter_test.go @@ -30,7 +30,10 @@ import ( "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/test/seriesiter" "github.com/m3db/m3/src/query/ts" + "github.com/m3db/m3/src/x/checked" xcost "github.com/m3db/m3/src/x/cost" + "github.com/m3db/m3/src/x/ident" + "github.com/m3db/m3/src/x/pool" xsync "github.com/m3db/m3/src/x/sync" "github.com/golang/mock/gomock" @@ -82,7 +85,7 @@ func verifyExpandPromSeries( func testExpandPromSeries(t *testing.T, ex bool, pools xsync.PooledWorkerPool) { ctrl := gomock.NewController(t) - for i := 0; i < 100; i++ { + for i := 0; i < 10; i++ { verifyExpandPromSeries(t, ctrl, i, ex, pools) } } @@ -166,3 +169,54 @@ func TestIteratorsToPromResult(t *testing.T) { assert.Equal(t, expected, result) } + +// overwrite overwrites existing tags with `!!!` literals. +type overwrite func() + +func setupTags(name, value string) (ident.Tags, overwrite) { + var buckets = []pool.Bucket{{Capacity: 100, Count: 2}} + bytesPool := pool.NewCheckedBytesPool(buckets, nil, + func(sizes []pool.Bucket) pool.BytesPool { + return pool.NewBytesPool(sizes, nil) + }) + + bytesPool.Init() + getFromPool := func(id string) checked.Bytes { + pID := bytesPool.Get(len(id)) + pID.IncRef() + pID.AppendAll([]byte(id)) + pID.DecRef() + return pID + } + + idPool := ident.NewPool(bytesPool, ident.PoolOptions{}) + tags := idPool.Tags() + tags.Append(idPool.BinaryTag(getFromPool(name), getFromPool(value))) + + overwrite := func() { + tags.Finalize() + getFromPool("!!!") + getFromPool("!!!") + } + + return tags, overwrite +} + +func TestTagIteratorToLabels(t *testing.T) { + name := "foo" + value := "bar" + tags, overwrite := setupTags(name, value) + tagIter := ident.NewTagsIterator(tags) + labels, err := tagIteratorToLabels(tagIter) + require.NoError(t, err) + + verifyTags := func() { + require.Equal(t, 1, len(labels)) + assert.Equal(t, name, string(labels[0].GetName())) + assert.Equal(t, value, string(labels[0].GetValue())) + } + + verifyTags() + overwrite() + verifyTags() +} diff --git a/src/query/tsdb/remote/codecs.go b/src/query/tsdb/remote/codecs.go index 706866a597..1404420595 100644 --- a/src/query/tsdb/remote/codecs.go +++ b/src/query/tsdb/remote/codecs.go @@ -204,7 +204,7 @@ func encodeFetchOptions(options *storage.FetchOptions) (*rpc.FetchOptions, error func encodeRestrictQueryOptionsByType( o *storage.RestrictByType, -) (*rpcpb.RestrictFetchType, error) { +) (*rpcpb.RestrictQueryType, error) { if o == nil { return nil, nil } @@ -213,7 +213,7 @@ func encodeRestrictQueryOptionsByType( return nil, err } - result := &rpcpb.RestrictFetchType{} + result := &rpcpb.RestrictQueryType{} switch o.MetricsType { case storage.UnaggregatedMetricsType: result.MetricsType = rpcpb.MetricsType_UNAGGREGATED_METRICS_TYPE @@ -233,7 +233,7 @@ func encodeRestrictQueryOptionsByType( func encodeRestrictQueryOptionsByTag( o *storage.RestrictByTag, -) (*rpcpb.RestrictFetchTags, error) { +) (*rpcpb.RestrictQueryTags, error) { if o == nil { return nil, nil } @@ -243,7 +243,7 @@ func encodeRestrictQueryOptionsByTag( return nil, err } - return &rpcpb.RestrictFetchTags{ + return &rpcpb.RestrictQueryTags{ Restrict: matchers, Strip: o.Strip, }, nil @@ -252,6 +252,10 @@ func encodeRestrictQueryOptionsByTag( func encodeRestrictQueryOptions( o *storage.RestrictQueryOptions, ) (*rpcpb.RestrictQueryOptions, error) { + if o == nil { + return nil, nil + } + byType, err := encodeRestrictQueryOptionsByType(o.GetRestrictByType()) if err != nil { return nil, err @@ -263,8 +267,8 @@ func encodeRestrictQueryOptions( } return &rpcpb.RestrictQueryOptions{ - RestrictFetchType: byType, - RestrictFetchTags: byTags, + RestrictQueryType: byType, + RestrictQueryTags: byTags, }, nil } @@ -378,7 +382,7 @@ func decodeFanoutOption(opt rpc.FanoutOption) (storage.FanoutOption, error) { } func decodeRestrictQueryOptionsByType( - p *rpc.RestrictFetchType, + p *rpc.RestrictQueryType, ) (*storage.RestrictByType, error) { if p == nil { return nil, nil @@ -411,7 +415,7 @@ func decodeRestrictQueryOptionsByType( } func decodeRestrictQueryOptionsByTag( - p *rpc.RestrictFetchTags, + p *rpc.RestrictQueryTags, ) (*storage.RestrictByTag, error) { if p == nil { return nil, nil @@ -431,12 +435,16 @@ func decodeRestrictQueryOptionsByTag( func decodeRestrictQueryOptions( p *rpc.RestrictQueryOptions, ) (*storage.RestrictQueryOptions, error) { - byType, err := decodeRestrictQueryOptionsByType(p.GetRestrictFetchType()) + if p == nil { + return nil, nil + } + + byType, err := decodeRestrictQueryOptionsByType(p.GetRestrictQueryType()) if err != nil { return nil, err } - byTag, err := decodeRestrictQueryOptionsByTag(p.GetRestrictFetchTags()) + byTag, err := decodeRestrictQueryOptionsByTag(p.GetRestrictQueryTags()) if err != nil { return nil, err } diff --git a/src/query/tsdb/remote/codecs_test.go b/src/query/tsdb/remote/codecs_test.go index e0b5a0d8c2..00a7189ea0 100644 --- a/src/query/tsdb/remote/codecs_test.go +++ b/src/query/tsdb/remote/codecs_test.go @@ -157,15 +157,15 @@ func TestEncodeFetchMessage(t *testing.T) { require.NotNil(t, grpcQ.Options) assert.Equal(t, int64(42), grpcQ.Options.Limit) require.NotNil(t, grpcQ.Options.Restrict) - require.NotNil(t, grpcQ.Options.Restrict.RestrictFetchType) + require.NotNil(t, grpcQ.Options.Restrict.RestrictQueryType) assert.Equal(t, rpc.MetricsType_AGGREGATED_METRICS_TYPE, - grpcQ.Options.Restrict.RestrictFetchType.MetricsType) - require.NotNil(t, grpcQ.Options.Restrict.RestrictFetchType.MetricsStoragePolicy) + grpcQ.Options.Restrict.RestrictQueryType.MetricsType) + require.NotNil(t, grpcQ.Options.Restrict.RestrictQueryType.MetricsStoragePolicy) expectedStoragePolicyProto, err := fetchOpts.RestrictQueryOptions. RestrictByType.StoragePolicy.Proto() require.NoError(t, err) assert.Equal(t, expectedStoragePolicyProto, grpcQ.Options.Restrict. - RestrictFetchType.MetricsStoragePolicy) + RestrictQueryType.MetricsStoragePolicy) assert.Equal(t, lookback, time.Duration(grpcQ.Options.LookbackDuration)) } @@ -245,7 +245,7 @@ func TestNewRestrictQueryOptionsFromProto(t *testing.T) { }{ { value: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_UNAGGREGATED_METRICS_TYPE, }, }, @@ -257,7 +257,7 @@ func TestNewRestrictQueryOptionsFromProto(t *testing.T) { }, { value: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_AGGREGATED_METRICS_TYPE, MetricsStoragePolicy: &policypb.StoragePolicy{ Resolution: &policypb.Resolution{ @@ -269,7 +269,7 @@ func TestNewRestrictQueryOptionsFromProto(t *testing.T) { }, }, }, - RestrictFetchTags: &rpc.RestrictFetchTags{ + RestrictQueryTags: &rpc.RestrictQueryTags{ Restrict: &rpc.TagMatchers{ TagMatchers: []*rpc.TagMatcher{ newRPCMatcher(rpc.MatcherType_NOTREGEXP, "foo", "bar"), @@ -300,7 +300,7 @@ func TestNewRestrictQueryOptionsFromProto(t *testing.T) { }, { value: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_UNKNOWN_METRICS_TYPE, }, }, @@ -308,7 +308,7 @@ func TestNewRestrictQueryOptionsFromProto(t *testing.T) { }, { value: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_UNAGGREGATED_METRICS_TYPE, MetricsStoragePolicy: &policypb.StoragePolicy{ Resolution: &policypb.Resolution{ @@ -325,7 +325,7 @@ func TestNewRestrictQueryOptionsFromProto(t *testing.T) { }, { value: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_AGGREGATED_METRICS_TYPE, MetricsStoragePolicy: &policypb.StoragePolicy{ Resolution: &policypb.Resolution{ @@ -338,7 +338,7 @@ func TestNewRestrictQueryOptionsFromProto(t *testing.T) { }, { value: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_AGGREGATED_METRICS_TYPE, MetricsStoragePolicy: &policypb.StoragePolicy{ Resolution: &policypb.Resolution{ @@ -352,7 +352,7 @@ func TestNewRestrictQueryOptionsFromProto(t *testing.T) { }, { value: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_AGGREGATED_METRICS_TYPE, MetricsStoragePolicy: &policypb.StoragePolicy{ Resolution: &policypb.Resolution{ @@ -417,10 +417,10 @@ func TestRestrictQueryOptionsProto(t *testing.T) { }, }, expected: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_UNAGGREGATED_METRICS_TYPE, }, - RestrictFetchTags: &rpcpb.RestrictFetchTags{ + RestrictQueryTags: &rpcpb.RestrictQueryTags{ Restrict: &rpc.TagMatchers{ TagMatchers: []*rpc.TagMatcher{ newRPCMatcher(rpc.MatcherType_NOTREGEXP, "foo", "bar"), @@ -446,7 +446,7 @@ func TestRestrictQueryOptionsProto(t *testing.T) { }, }, expected: &rpcpb.RestrictQueryOptions{ - RestrictFetchType: &rpcpb.RestrictFetchType{ + RestrictQueryType: &rpcpb.RestrictQueryType{ MetricsType: rpcpb.MetricsType_AGGREGATED_METRICS_TYPE, MetricsStoragePolicy: &policypb.StoragePolicy{ Resolution: &policypb.Resolution{ @@ -458,7 +458,7 @@ func TestRestrictQueryOptionsProto(t *testing.T) { }, }, }, - RestrictFetchTags: &rpcpb.RestrictFetchTags{ + RestrictQueryTags: &rpcpb.RestrictQueryTags{ Restrict: &rpc.TagMatchers{ TagMatchers: []*rpc.TagMatcher{ newRPCMatcher(rpc.MatcherType_NOTREGEXP, "foo", "bar"),