From a9a6dd19d13e8c5d54ea311bba4f3b7778238608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8C=B2=20Harry=20=F0=9F=8C=8A=20John=20=F0=9F=8F=94?= Date: Thu, 12 Sep 2024 10:21:37 -0700 Subject: [PATCH] Add matchers to LabelNames() ingester RPC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 🌲 Harry 🌊 John 🏔 --- CHANGELOG.md | 1 + docs/blocks-storage/querier.md | 4 + docs/configuration/config-file-reference.md | 4 + pkg/distributor/distributor.go | 18 +- pkg/ingester/client/compat.go | 30 +++ pkg/ingester/client/ingester.pb.go | 244 +++++++++++++------- pkg/ingester/client/ingester.proto | 1 + pkg/ingester/ingester.go | 11 +- pkg/ingester/ingester_test.go | 1 + pkg/querier/distributor_queryable.go | 32 +-- pkg/querier/distributor_queryable_test.go | 69 +++--- pkg/querier/querier.go | 18 +- pkg/querier/querier_test.go | 16 +- pkg/querier/testutils.go | 8 +- 14 files changed, 293 insertions(+), 164 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b748b3d5db..c3ad113c5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * [ENHANCEMENT] Ingester: Add new API `/ingester/all_user_stats` which shows loaded blocks, active timeseries and ingestion rate for a specific ingester. #6178 * [ENHANCEMENT] Distributor: Add new `cortex_reduced_resolution_histogram_samples_total` metric to track the number of histogram samples which resolution was reduced. #6182 * [ENHANCEMENT] StoreGateway: Implement metadata API limit in queryable. #6195 +* [ENHANCEMENT] Ingester: Add matchers to ingester LabelNames() and LabelNamesStream() RPC. #6209 ## 1.18.0 2024-09-03 diff --git a/docs/blocks-storage/querier.md b/docs/blocks-storage/querier.md index 8cd0b9f008..41d0f433bf 100644 --- a/docs/blocks-storage/querier.md +++ b/docs/blocks-storage/querier.md @@ -109,6 +109,10 @@ querier: # CLI flag: -querier.ingester-metadata-streaming [ingester_metadata_streaming: | default = true] + # Use LabelNames ingester RPCs with match params. + # CLI flag: -querier.ingester-label-names-with-matchers + [ingester_label_names_with_matchers: | default = false] + # Maximum number of samples a single query can load into memory. # CLI flag: -querier.max-samples [max_samples: | default = 50000000] diff --git a/docs/configuration/config-file-reference.md b/docs/configuration/config-file-reference.md index 46bf10e4f6..a8ff9ef928 100644 --- a/docs/configuration/config-file-reference.md +++ b/docs/configuration/config-file-reference.md @@ -3701,6 +3701,10 @@ The `querier_config` configures the Cortex querier. # CLI flag: -querier.ingester-metadata-streaming [ingester_metadata_streaming: | default = true] +# Use LabelNames ingester RPCs with match params. +# CLI flag: -querier.ingester-label-names-with-matchers +[ingester_label_names_with_matchers: | default = false] + # Maximum number of samples a single query can load into memory. # CLI flag: -querier.max-samples [max_samples: | default = 50000000] diff --git a/pkg/distributor/distributor.go b/pkg/distributor/distributor.go index 351187ba83..5be42e3e96 100644 --- a/pkg/distributor/distributor.go +++ b/pkg/distributor/distributor.go @@ -1101,7 +1101,7 @@ func (d *Distributor) LabelValuesForLabelNameStream(ctx context.Context, from, t }, matchers...) } -func (d *Distributor) LabelNamesCommon(ctx context.Context, from, to model.Time, hints *storage.LabelHints, f func(ctx context.Context, rs ring.ReplicationSet, req *ingester_client.LabelNamesRequest) ([]interface{}, error)) ([]string, error) { +func (d *Distributor) LabelNamesCommon(ctx context.Context, from, to model.Time, hints *storage.LabelHints, f func(ctx context.Context, rs ring.ReplicationSet, req *ingester_client.LabelNamesRequest) ([]interface{}, error), matchers ...*labels.Matcher) ([]string, error) { span, ctx := opentracing.StartSpanFromContext(ctx, "Distributor.LabelNames", opentracing.Tags{ "start": from.Unix(), "end": to.Unix(), @@ -1113,11 +1113,11 @@ func (d *Distributor) LabelNamesCommon(ctx context.Context, from, to model.Time, } limit := getLimitFromLabelHints(hints) - req := &ingester_client.LabelNamesRequest{ - StartTimestampMs: int64(from), - EndTimestampMs: int64(to), - Limit: int64(limit), + req, err := ingester_client.ToLabelNamesRequest(from, to, limit, matchers) + if err != nil { + return nil, err } + resps, err := f(ctx, replicationSet, req) if err != nil { return nil, err @@ -1142,7 +1142,7 @@ func (d *Distributor) LabelNamesCommon(ctx context.Context, from, to model.Time, return r, nil } -func (d *Distributor) LabelNamesStream(ctx context.Context, from, to model.Time, hints *storage.LabelHints) ([]string, error) { +func (d *Distributor) LabelNamesStream(ctx context.Context, from, to model.Time, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error) { return d.LabelNamesCommon(ctx, from, to, hints, func(ctx context.Context, rs ring.ReplicationSet, req *ingester_client.LabelNamesRequest) ([]interface{}, error) { return d.ForReplicationSet(ctx, rs, d.cfg.ZoneResultsQuorumMetadata, func(ctx context.Context, client ingester_client.IngesterClient) (interface{}, error) { stream, err := client.LabelNamesStream(ctx, req) @@ -1164,11 +1164,11 @@ func (d *Distributor) LabelNamesStream(ctx context.Context, from, to model.Time, return allLabelNames, nil }) - }) + }, matchers...) } // LabelNames returns all the label names. -func (d *Distributor) LabelNames(ctx context.Context, from, to model.Time, hint *storage.LabelHints) ([]string, error) { +func (d *Distributor) LabelNames(ctx context.Context, from, to model.Time, hint *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error) { return d.LabelNamesCommon(ctx, from, to, hint, func(ctx context.Context, rs ring.ReplicationSet, req *ingester_client.LabelNamesRequest) ([]interface{}, error) { return d.ForReplicationSet(ctx, rs, d.cfg.ZoneResultsQuorumMetadata, func(ctx context.Context, client ingester_client.IngesterClient) (interface{}, error) { resp, err := client.LabelNames(ctx, req) @@ -1177,7 +1177,7 @@ func (d *Distributor) LabelNames(ctx context.Context, from, to model.Time, hint } return resp.LabelNames, nil }) - }) + }, matchers...) } // MetricsForLabelMatchers gets the metrics that match said matchers diff --git a/pkg/ingester/client/compat.go b/pkg/ingester/client/compat.go index 6e4a81d634..1a8e178641 100644 --- a/pkg/ingester/client/compat.go +++ b/pkg/ingester/client/compat.go @@ -220,6 +220,36 @@ func FromLabelValuesRequest(req *LabelValuesRequest) (string, int64, int64, int, return req.LabelName, req.StartTimestampMs, req.EndTimestampMs, int(req.Limit), matchers, nil } +// ToLabelNamesRequest builds a LabelNamesRequest proto +func ToLabelNamesRequest(from, to model.Time, limit int, matchers []*labels.Matcher) (*LabelNamesRequest, error) { + ms, err := toLabelMatchers(matchers) + if err != nil { + return nil, err + } + + return &LabelNamesRequest{ + StartTimestampMs: int64(from), + EndTimestampMs: int64(to), + Matchers: &LabelMatchers{Matchers: ms}, + Limit: int64(limit), + }, nil +} + +// FromLabelNamesRequest unpacks a LabelNamesRequest proto +func FromLabelNamesRequest(req *LabelNamesRequest) (int64, int64, int, []*labels.Matcher, error) { + var err error + var matchers []*labels.Matcher + + if req.Matchers != nil { + matchers, err = FromLabelMatchers(req.Matchers.Matchers) + if err != nil { + return 0, 0, 0, nil, err + } + } + + return req.StartTimestampMs, req.EndTimestampMs, int(req.Limit), matchers, nil +} + func toLabelMatchers(matchers []*labels.Matcher) ([]*LabelMatcher, error) { result := make([]*LabelMatcher, 0, len(matchers)) for _, matcher := range matchers { diff --git a/pkg/ingester/client/ingester.pb.go b/pkg/ingester/client/ingester.pb.go index 23f1fbdf5b..374348afae 100644 --- a/pkg/ingester/client/ingester.pb.go +++ b/pkg/ingester/client/ingester.pb.go @@ -559,9 +559,10 @@ func (m *LabelValuesStreamResponse) GetLabelValues() []string { } type LabelNamesRequest struct { - StartTimestampMs int64 `protobuf:"varint,1,opt,name=start_timestamp_ms,json=startTimestampMs,proto3" json:"start_timestamp_ms,omitempty"` - EndTimestampMs int64 `protobuf:"varint,2,opt,name=end_timestamp_ms,json=endTimestampMs,proto3" json:"end_timestamp_ms,omitempty"` - Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + StartTimestampMs int64 `protobuf:"varint,1,opt,name=start_timestamp_ms,json=startTimestampMs,proto3" json:"start_timestamp_ms,omitempty"` + EndTimestampMs int64 `protobuf:"varint,2,opt,name=end_timestamp_ms,json=endTimestampMs,proto3" json:"end_timestamp_ms,omitempty"` + Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + Matchers *LabelMatchers `protobuf:"bytes,4,opt,name=matchers,proto3" json:"matchers,omitempty"` } func (m *LabelNamesRequest) Reset() { *m = LabelNamesRequest{} } @@ -617,6 +618,13 @@ func (m *LabelNamesRequest) GetLimit() int64 { return 0 } +func (m *LabelNamesRequest) GetMatchers() *LabelMatchers { + if m != nil { + return m.Matchers + } + return nil +} + type LabelNamesResponse struct { LabelNames []string `protobuf:"bytes,1,rep,name=label_names,json=labelNames,proto3" json:"label_names,omitempty"` } @@ -1476,90 +1484,91 @@ func init() { func init() { proto.RegisterFile("ingester.proto", fileDescriptor_60f6df4f3586b478) } var fileDescriptor_60f6df4f3586b478 = []byte{ - // 1328 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4b, 0x6f, 0xd4, 0x56, - 0x14, 0x1e, 0x67, 0x1e, 0xc9, 0x9c, 0x79, 0x30, 0xb9, 0x09, 0x64, 0x30, 0xc5, 0x01, 0x23, 0xda, - 0xa8, 0x2d, 0x09, 0xa4, 0xad, 0x04, 0x7d, 0xa1, 0x04, 0x02, 0x04, 0x08, 0x01, 0x27, 0xd0, 0xaa, - 0x6a, 0x65, 0x39, 0x33, 0x97, 0xc4, 0xc5, 0x8f, 0xc1, 0xf7, 0x1a, 0x41, 0x57, 0x45, 0xfd, 0x01, - 0xed, 0xb2, 0xdb, 0xee, 0xfa, 0x53, 0x58, 0xb2, 0xe8, 0x02, 0x75, 0x81, 0xca, 0x20, 0x55, 0x5d, - 0xd2, 0x7f, 0x50, 0xf9, 0x3e, 0xfc, 0x8a, 0xf3, 0x40, 0x82, 0xee, 0x7c, 0xcf, 0xf9, 0xce, 0xb9, - 0xe7, 0x79, 0xcf, 0x31, 0xb4, 0x6d, 0x6f, 0x13, 0x13, 0x8a, 0x83, 0xd9, 0x41, 0x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 0x74, 0x5c, 0xee, 0xa3, 0x53, 0x50, 0xe9, 0x5b, 0xd4, 0x62, 0x0e, 0x37, 0xe6, 0x0f, 0xcb, - 0xf2, 0xdf, 0x16, 0x46, 0x83, 0xc1, 0xf4, 0xcb, 0x80, 0x22, 0x16, 0xc9, 0x6a, 0x3f, 0x03, 0x55, - 0x12, 0x11, 0xc4, 0x63, 0x70, 0x24, 0xad, 0x25, 0x67, 0x89, 0xc1, 0x91, 0xfa, 0x13, 0x05, 0xb4, - 0x15, 0x4c, 0x03, 0xbb, 0x47, 0x2e, 0xf9, 0x41, 0xb6, 0xdb, 0xde, 0x72, 0x11, 0x9f, 0x85, 0xa6, - 0x6c, 0x67, 0x93, 0x60, 0xba, 0xfb, 0x6b, 0xdb, 0x90, 0xd0, 0x35, 0x4c, 0x93, 0xf2, 0xaf, 0xa4, - 0xcb, 0xff, 0x1a, 0x4c, 0xef, 0xe8, 0x89, 0x08, 0xd0, 0x0c, 0xd4, 0x5c, 0x06, 0x11, 0x11, 0xea, - 0x24, 0xcf, 0x25, 0x17, 0x35, 0x04, 0x5f, 0xbf, 0x05, 0x27, 0x77, 0x50, 0x96, 0xeb, 0x90, 0xfd, - 0xab, 0xec, 0xc2, 0x21, 0xa1, 0x72, 0x05, 0x53, 0x2b, 0x4a, 0xa3, 0x6c, 0x98, 0x55, 0x98, 0xda, - 0xc6, 0x11, 0xea, 0x3f, 0x86, 0x31, 0x57, 0xd0, 0xc4, 0x05, 0xdd, 0xfc, 0x05, 0xb1, 0x4c, 0x8c, - 0xd4, 0xff, 0x55, 0xe0, 0x40, 0x6e, 0xc0, 0x44, 0x89, 0xb9, 0x1b, 0xf8, 0xae, 0x29, 0x37, 0xa4, - 0xa4, 0x06, 0xdb, 0x11, 0x7d, 0x59, 0x90, 0x97, 0xfb, 0xe9, 0x22, 0x1d, 0xc9, 0x14, 0xa9, 0x07, - 0x35, 0xd6, 0xfa, 0x72, 0x32, 0x4e, 0x24, 0xa6, 0xb0, 0x10, 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 0x7e, 0xc4, 0xa0, 0x77, 0xe3, 0xc6, 0xde, 0x75, 0x34, 0xab, 0xef, - 0xed, 0x89, 0x8b, 0x6f, 0xfb, 0x01, 0x8e, 0xee, 0x3a, 0xd0, 0xf6, 0x7d, 0xe7, 0xa9, 0x3d, 0x70, - 0x05, 0x51, 0x5f, 0x87, 0x03, 0xb9, 0xf9, 0x86, 0xb4, 0x9c, 0x96, 0xdc, 0x48, 0x54, 0xa7, 0x77, - 0xe4, 0x4b, 0xbd, 0x8b, 0x9f, 0x3f, 0x7d, 0xa1, 0x95, 0x9e, 0xbd, 0xd0, 0x4a, 0xaf, 0x5e, 0x68, - 0xca, 0x8f, 0x43, 0x4d, 0xf9, 0x7d, 0xa8, 0x29, 0x4f, 0x86, 0x9a, 0xf2, 0x74, 0xa8, 0x29, 0x7f, - 0x0d, 0x35, 0xe5, 0x9f, 0xa1, 0x56, 0x7a, 0x35, 0xd4, 0x94, 0x5f, 0x5e, 0x6a, 0xa5, 0xa7, 0x2f, - 0xb5, 0xd2, 0xb3, 0x97, 0x5a, 0xe9, 0x9b, 0x5a, 0xcf, 0xb1, 0xb1, 0x47, 0x37, 0x6a, 0xec, 0x3f, - 0xfe, 0xa3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc5, 0xfc, 0x4c, 0xf5, 0x32, 0x10, 0x00, 0x00, + // 1339 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4b, 0x6f, 0x14, 0xc7, + 0x13, 0xdf, 0xf1, 0x3e, 0xec, 0xad, 0x7d, 0xb0, 0x6e, 0x1b, 0xbc, 0x0c, 0x7f, 0xc6, 0x30, 0x88, + 0x7f, 0xac, 0x24, 0xd8, 0xe0, 0x24, 0x12, 0xe4, 0x85, 0x6c, 0x30, 0x60, 0xc0, 0x18, 0xc6, 0x86, + 0x44, 0x51, 0xa2, 0xd1, 0x78, 0xb7,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 0x29, 0x0a, + 0x62, 0xb0, 0x31, 0xbb, 0x6e, 0xbb, 0x78, 0x8d, 0xe9, 0x16, 0x2b, 0x8f, 0x9f, 0x4d, 0x97, 0x8c, + 0x14, 0x5a, 0xff, 0x49, 0x81, 0x66, 0x3a, 0x4e, 0xf4, 0x2e, 0x20, 0x42, 0xad, 0x80, 0x9a, 0x0c, + 0x44, 0x2d, 0x77, 0x60, 0xba, 0x91, 0x53, 0x65, 0xa6, 0x6c, 0x74, 0x98, 0x66, 0x5d, 0x2a, 0x56, + 0x08, 0x9a, 0x81, 0x0e, 0xf6, 0xfa, 0x59, 0xec, 0x08, 0xc3, 0xb6, 0xb1, 0xd7, 0x4f, 0x23, 0x4f, + 0xc3, 0x98, 0x6b, 0xd1, 0xde, 0x16, 0x0e, 0x48, 0xb7, 0x9c, 0xe5, 0xe9, 0xba, 0xb5, 0x81, 0x9d, + 0x15, 0xae, 0x34, 0x62, 0x94, 0xfe, 0xb3, 0x02, 0x93, 0x4b, 0x0f, 0xb1, 0x3b, 0x70, 0xac, 0xe0, + 0x3f, 0x09, 0xf1, 0xcc, 0xb6, 0x10, 0x0f, 0x16, 0x85, 0x48, 0x52, 0x31, 0x7e, 0x09, 0x13, 0x2c, + 0xb4, 0x35, 0x1a, 0x60, 0xcb, 0x8d, 0x6f, 0xe4, 0x3c, 0x34, 0x7a, 0x5b, 0xa1, 0x77, 0x2f, 0x73, + 0x25, 0x53, 0xd2, 0x59, 0x72, 0x21, 0x17, 0x22, 0x90, 0xb8, 0x95, 0xb4, 0xc5, 0xd5, 0xca, 0xd8, + 0x48, 0xa7, 0xac, 0xaf, 0xc1, 0xc1, 0x1c, 0x01, 0xaf, 0xe1, 0xc6, 0x7f, 0x53, 0x00, 0xb1, 0x74, + 0xee, 0x58, 0x4e, 0x88, 0x89, 0x24, 0xf5, 0x28, 0x80, 0x13, 0x49, 0x4d, 0xcf, 0x72, 0x31, 0x23, + 0xb3, 0x6e, 0xd4, 0x99, 0xe4, 0x86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ff, 0xff, 0x84, 0xf7, 0x8d, 0x61, 0x65, 0x10, 0x00, 0x00, } func (x MatchType) String() string { @@ -1906,6 +1915,9 @@ func (this *LabelNamesRequest) Equal(that interface{}) bool { if this.Limit != that1.Limit { return false } + if !this.Matchers.Equal(that1.Matchers) { + return false + } return true } func (this *LabelNamesResponse) Equal(that interface{}) bool { @@ -2536,11 +2548,14 @@ func (this *LabelNamesRequest) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 7) + s := make([]string, 0, 8) s = append(s, "&client.LabelNamesRequest{") s = append(s, "StartTimestampMs: "+fmt.Sprintf("%#v", this.StartTimestampMs)+",\n") s = append(s, "EndTimestampMs: "+fmt.Sprintf("%#v", this.EndTimestampMs)+",\n") s = append(s, "Limit: "+fmt.Sprintf("%#v", this.Limit)+",\n") + if this.Matchers != nil { + s = append(s, "Matchers: "+fmt.Sprintf("%#v", this.Matchers)+",\n") + } s = append(s, "}") return strings.Join(s, "") } @@ -3756,6 +3771,18 @@ func (m *LabelNamesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Matchers != nil { + { + size, err := m.Matchers.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintIngester(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if m.Limit != 0 { i = encodeVarintIngester(dAtA, i, uint64(m.Limit)) i-- @@ -4621,6 +4648,10 @@ func (m *LabelNamesRequest) Size() (n int) { if m.Limit != 0 { n += 1 + sovIngester(uint64(m.Limit)) } + if m.Matchers != nil { + l = m.Matchers.Size() + n += 1 + l + sovIngester(uint64(l)) + } return n } @@ -5068,6 +5099,7 @@ func (this *LabelNamesRequest) String() string { `StartTimestampMs:` + fmt.Sprintf("%v", this.StartTimestampMs) + `,`, `EndTimestampMs:` + fmt.Sprintf("%v", this.EndTimestampMs) + `,`, `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, + `Matchers:` + strings.Replace(this.Matchers.String(), "LabelMatchers", "LabelMatchers", 1) + `,`, `}`, }, "") return s @@ -6412,6 +6444,42 @@ func (m *LabelNamesRequest) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Matchers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIngester + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIngester + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIngester + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Matchers == nil { + m.Matchers = &LabelMatchers{} + } + if err := m.Matchers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipIngester(dAtA[iNdEx:]) diff --git a/pkg/ingester/client/ingester.proto b/pkg/ingester/client/ingester.proto index 34b9662264..68f343693e 100644 --- a/pkg/ingester/client/ingester.proto +++ b/pkg/ingester/client/ingester.proto @@ -82,6 +82,7 @@ message LabelNamesRequest { int64 start_timestamp_ms = 1; int64 end_timestamp_ms = 2; int64 limit = 3; + LabelMatchers matchers = 4; } message LabelNamesResponse { diff --git a/pkg/ingester/ingester.go b/pkg/ingester/ingester.go index 82e4bff755..1652b7ec32 100644 --- a/pkg/ingester/ingester.go +++ b/pkg/ingester/ingester.go @@ -1591,6 +1591,11 @@ func (i *Ingester) labelNamesCommon(ctx context.Context, req *client.LabelNamesR return nil, cleanup, err } + startTimestampMs, endTimestampMs, limit, matchers, err := client.FromLabelNamesRequest(req) + if err != nil { + return nil, cleanup, err + } + userID, err := tenant.TenantID(ctx) if err != nil { return nil, cleanup, err @@ -1601,13 +1606,11 @@ func (i *Ingester) labelNamesCommon(ctx context.Context, req *client.LabelNamesR return &client.LabelNamesResponse{}, cleanup, nil } - mint, maxt, err := metadataQueryRange(req.StartTimestampMs, req.EndTimestampMs, db, i.cfg.QueryIngestersWithin) + mint, maxt, err := metadataQueryRange(startTimestampMs, endTimestampMs, db, i.cfg.QueryIngestersWithin) if err != nil { return nil, cleanup, err } - limit := int(req.Limit) - q, err := db.Querier(mint, maxt) if err != nil { return nil, cleanup, err @@ -1622,7 +1625,7 @@ func (i *Ingester) labelNamesCommon(ctx context.Context, req *client.LabelNamesR return nil, cleanup, err } defer c() - names, _, err := q.LabelNames(ctx, &storage.LabelHints{Limit: limit}) + names, _, err := q.LabelNames(ctx, &storage.LabelHints{Limit: limit}, matchers...) if err != nil { return nil, cleanup, err } diff --git a/pkg/ingester/ingester_test.go b/pkg/ingester/ingester_test.go index d478017d2c..3b28bfc3fe 100644 --- a/pkg/ingester/ingester_test.go +++ b/pkg/ingester/ingester_test.go @@ -2302,6 +2302,7 @@ func Test_Ingester_LabelValues(t *testing.T) { tests := map[string]struct { limit int64 + match []*labels.Matcher }{ "should return all label values if no limit is set": { limit: 0, diff --git a/pkg/querier/distributor_queryable.go b/pkg/querier/distributor_queryable.go index a2f5a50f46..8ae7c49106 100644 --- a/pkg/querier/distributor_queryable.go +++ b/pkg/querier/distributor_queryable.go @@ -29,27 +29,29 @@ type Distributor interface { QueryExemplars(ctx context.Context, from, to model.Time, matchers ...[]*labels.Matcher) (*client.ExemplarQueryResponse, error) LabelValuesForLabelName(ctx context.Context, from, to model.Time, label model.LabelName, hint *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error) LabelValuesForLabelNameStream(ctx context.Context, from, to model.Time, label model.LabelName, hint *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error) - LabelNames(context.Context, model.Time, model.Time, *storage.LabelHints) ([]string, error) - LabelNamesStream(context.Context, model.Time, model.Time, *storage.LabelHints) ([]string, error) + LabelNames(context.Context, model.Time, model.Time, *storage.LabelHints, ...*labels.Matcher) ([]string, error) + LabelNamesStream(context.Context, model.Time, model.Time, *storage.LabelHints, ...*labels.Matcher) ([]string, error) MetricsForLabelMatchers(ctx context.Context, from, through model.Time, hint *storage.SelectHints, matchers ...*labels.Matcher) ([]model.Metric, error) MetricsForLabelMatchersStream(ctx context.Context, from, through model.Time, hint *storage.SelectHints, matchers ...*labels.Matcher) ([]model.Metric, error) MetricsMetadata(ctx context.Context) ([]scrape.MetricMetadata, error) } -func newDistributorQueryable(distributor Distributor, streamingMetdata bool, iteratorFn chunkIteratorFunc, queryIngestersWithin time.Duration) QueryableWithFilter { +func newDistributorQueryable(distributor Distributor, streamingMetdata bool, labelNamesWithMatchers bool, iteratorFn chunkIteratorFunc, queryIngestersWithin time.Duration) QueryableWithFilter { return distributorQueryable{ - distributor: distributor, - streamingMetdata: streamingMetdata, - iteratorFn: iteratorFn, - queryIngestersWithin: queryIngestersWithin, + distributor: distributor, + streamingMetdata: streamingMetdata, + labelNamesWithMatchers: labelNamesWithMatchers, + iteratorFn: iteratorFn, + queryIngestersWithin: queryIngestersWithin, } } type distributorQueryable struct { - distributor Distributor - streamingMetdata bool - iteratorFn chunkIteratorFunc - queryIngestersWithin time.Duration + distributor Distributor + streamingMetdata bool + labelNamesWithMatchers bool + iteratorFn chunkIteratorFunc + queryIngestersWithin time.Duration } func (d distributorQueryable) Querier(mint, maxt int64) (storage.Querier, error) { @@ -58,6 +60,7 @@ func (d distributorQueryable) Querier(mint, maxt int64) (storage.Querier, error) mint: mint, maxt: maxt, streamingMetadata: d.streamingMetdata, + labelNamesMatchers: d.labelNamesWithMatchers, chunkIterFn: d.iteratorFn, queryIngestersWithin: d.queryIngestersWithin, }, nil @@ -72,6 +75,7 @@ type distributorQuerier struct { distributor Distributor mint, maxt int64 streamingMetadata bool + labelNamesMatchers bool chunkIterFn chunkIteratorFunc queryIngestersWithin time.Duration } @@ -180,7 +184,7 @@ func (q *distributorQuerier) LabelValues(ctx context.Context, name string, hints } func (q *distributorQuerier) LabelNames(ctx context.Context, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, annotations.Annotations, error) { - if len(matchers) > 0 { + if len(matchers) > 0 && !q.labelNamesMatchers { return q.labelNamesWithMatchers(ctx, hints, matchers...) } @@ -193,9 +197,9 @@ func (q *distributorQuerier) LabelNames(ctx context.Context, hints *storage.Labe ) if q.streamingMetadata { - ln, err = q.distributor.LabelNamesStream(ctx, model.Time(q.mint), model.Time(q.maxt), hints) + ln, err = q.distributor.LabelNamesStream(ctx, model.Time(q.mint), model.Time(q.maxt), hints, matchers...) } else { - ln, err = q.distributor.LabelNames(ctx, model.Time(q.mint), model.Time(q.maxt), hints) + ln, err = q.distributor.LabelNames(ctx, model.Time(q.mint), model.Time(q.maxt), hints, matchers...) } return ln, nil, err diff --git a/pkg/querier/distributor_queryable_test.go b/pkg/querier/distributor_queryable_test.go index c5decf75e9..1914c49e88 100644 --- a/pkg/querier/distributor_queryable_test.go +++ b/pkg/querier/distributor_queryable_test.go @@ -89,7 +89,7 @@ func TestDistributorQuerier_SelectShouldHonorQueryIngestersWithin(t *testing.T) distributor.On("MetricsForLabelMatchersStream", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return([]model.Metric{}, nil) ctx := user.InjectOrgID(context.Background(), "test") - queryable := newDistributorQueryable(distributor, streamingMetadataEnabled, nil, testData.queryIngestersWithin) + queryable := newDistributorQueryable(distributor, streamingMetadataEnabled, true, nil, testData.queryIngestersWithin) querier, err := queryable.Querier(testData.queryMinT, testData.queryMaxT) require.NoError(t, err) @@ -128,7 +128,7 @@ func TestDistributorQueryableFilter(t *testing.T) { t.Parallel() d := &MockDistributor{} - dq := newDistributorQueryable(d, false, nil, 1*time.Hour) + dq := newDistributorQueryable(d, false, true, nil, 1*time.Hour) now := time.Now() @@ -172,7 +172,7 @@ func TestIngesterStreaming(t *testing.T) { nil) ctx := user.InjectOrgID(context.Background(), "0") - queryable := newDistributorQueryable(d, true, batch.NewChunkMergeIterator, 0) + queryable := newDistributorQueryable(d, true, true, batch.NewChunkMergeIterator, 0) querier, err := queryable.Querier(mint, maxt) require.NoError(t, err) @@ -202,31 +202,42 @@ func TestDistributorQuerier_LabelNames(t *testing.T) { someMatchers := []*labels.Matcher{labels.MustNewMatcher(labels.MatchEqual, "foo", "bar")} labelNames := []string{"foo", "job"} - for _, streamingEnabled := range []bool{false, true} { - streamingEnabled := streamingEnabled - t.Run("with matchers", func(t *testing.T) { - t.Parallel() - - metrics := []model.Metric{ - {"foo": "bar"}, - {"job": "baz"}, - {"job": "baz", "foo": "boom"}, - } - d := &MockDistributor{} - d.On("MetricsForLabelMatchers", mock.Anything, model.Time(mint), model.Time(maxt), mock.Anything, someMatchers). - Return(metrics, nil) - d.On("MetricsForLabelMatchersStream", mock.Anything, model.Time(mint), model.Time(maxt), mock.Anything, someMatchers). - Return(metrics, nil) - - queryable := newDistributorQueryable(d, streamingEnabled, nil, 0) - querier, err := queryable.Querier(mint, maxt) - require.NoError(t, err) - - ctx := context.Background() - names, warnings, err := querier.LabelNames(ctx, nil, someMatchers...) - require.NoError(t, err) - assert.Empty(t, warnings) - assert.Equal(t, labelNames, names) - }) + for _, labelNamesWithMatchers := range []bool{false, true} { + for _, streamingEnabled := range []bool{false, true} { + streamingEnabled := streamingEnabled + labelNamesWithMatchers := labelNamesWithMatchers + t.Run("with matchers", func(t *testing.T) { + t.Parallel() + + metrics := []model.Metric{ + {"foo": "bar"}, + {"job": "baz"}, + {"job": "baz", "foo": "boom"}, + } + d := &MockDistributor{} + + if labelNamesWithMatchers { + d.On("LabelNames", mock.Anything, model.Time(mint), model.Time(maxt), mock.Anything, someMatchers). + Return(labelNames, nil) + d.On("LabelNamesStream", mock.Anything, model.Time(mint), model.Time(maxt), mock.Anything, someMatchers). + Return(labelNames, nil) + } else { + d.On("MetricsForLabelMatchers", mock.Anything, model.Time(mint), model.Time(maxt), mock.Anything, someMatchers). + Return(metrics, nil) + d.On("MetricsForLabelMatchersStream", mock.Anything, model.Time(mint), model.Time(maxt), mock.Anything, someMatchers). + Return(metrics, nil) + } + + queryable := newDistributorQueryable(d, streamingEnabled, labelNamesWithMatchers, nil, 0) + querier, err := queryable.Querier(mint, maxt) + require.NoError(t, err) + + ctx := context.Background() + names, warnings, err := querier.LabelNames(ctx, nil, someMatchers...) + require.NoError(t, err) + assert.Empty(t, warnings) + assert.Equal(t, labelNames, names) + }) + } } } diff --git a/pkg/querier/querier.go b/pkg/querier/querier.go index c8bf9e7a0d..cdf24ee3db 100644 --- a/pkg/querier/querier.go +++ b/pkg/querier/querier.go @@ -41,13 +41,14 @@ import ( // Config contains the configuration require to create a querier type Config struct { - MaxConcurrent int `yaml:"max_concurrent"` - Timeout time.Duration `yaml:"timeout"` - IngesterStreaming bool `yaml:"ingester_streaming" doc:"hidden"` - IngesterMetadataStreaming bool `yaml:"ingester_metadata_streaming"` - MaxSamples int `yaml:"max_samples"` - QueryIngestersWithin time.Duration `yaml:"query_ingesters_within"` - EnablePerStepStats bool `yaml:"per_step_stats_enabled"` + MaxConcurrent int `yaml:"max_concurrent"` + Timeout time.Duration `yaml:"timeout"` + IngesterStreaming bool `yaml:"ingester_streaming" doc:"hidden"` + IngesterMetadataStreaming bool `yaml:"ingester_metadata_streaming"` + IngesterLabelNamesWithMatchers bool `yaml:"ingester_label_names_with_matchers"` + MaxSamples int `yaml:"max_samples"` + QueryIngestersWithin time.Duration `yaml:"query_ingesters_within"` + EnablePerStepStats bool `yaml:"per_step_stats_enabled"` // QueryStoreAfter the time after which queries should also be sent to the store and not just ingesters. QueryStoreAfter time.Duration `yaml:"query_store_after"` @@ -106,6 +107,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) { f.IntVar(&cfg.MaxConcurrent, "querier.max-concurrent", 20, "The maximum number of concurrent queries.") f.DurationVar(&cfg.Timeout, "querier.timeout", 2*time.Minute, "The timeout for a query.") f.BoolVar(&cfg.IngesterMetadataStreaming, "querier.ingester-metadata-streaming", true, "Deprecated (This feature will be always on after v1.18): Use streaming RPCs for metadata APIs from ingester.") + f.BoolVar(&cfg.IngesterLabelNamesWithMatchers, "querier.ingester-label-names-with-matchers", false, "Use LabelNames ingester RPCs with match params.") f.IntVar(&cfg.MaxSamples, "querier.max-samples", 50e6, "Maximum number of samples a single query can load into memory.") f.DurationVar(&cfg.QueryIngestersWithin, "querier.query-ingesters-within", 0, "Maximum lookback beyond which queries are not sent to ingester. 0 means all queries are sent to ingester.") f.BoolVar(&cfg.EnablePerStepStats, "querier.per-step-stats-enabled", false, "Enable returning samples stats per steps in query response.") @@ -156,7 +158,7 @@ func getChunksIteratorFunction(_ Config) chunkIteratorFunc { func New(cfg Config, limits *validation.Overrides, distributor Distributor, stores []QueryableWithFilter, reg prometheus.Registerer, logger log.Logger) (storage.SampleAndChunkQueryable, storage.ExemplarQueryable, promql.QueryEngine) { iteratorFunc := getChunksIteratorFunction(cfg) - distributorQueryable := newDistributorQueryable(distributor, cfg.IngesterMetadataStreaming, iteratorFunc, cfg.QueryIngestersWithin) + distributorQueryable := newDistributorQueryable(distributor, cfg.IngesterMetadataStreaming, cfg.IngesterLabelNamesWithMatchers, iteratorFunc, cfg.QueryIngestersWithin) ns := make([]QueryableWithFilter, len(stores)) for ix, s := range stores { diff --git a/pkg/querier/querier_test.go b/pkg/querier/querier_test.go index 17b4be651d..ddea8e182a 100644 --- a/pkg/querier/querier_test.go +++ b/pkg/querier/querier_test.go @@ -296,7 +296,7 @@ func TestShouldSortSeriesIfQueryingMultipleQueryables(t *testing.T) { } distributor.On("QueryStream", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&unorderedResponse, nil) - distributorQueryable := newDistributorQueryable(distributor, cfg.IngesterMetadataStreaming, batch.NewChunkMergeIterator, cfg.QueryIngestersWithin) + distributorQueryable := newDistributorQueryable(distributor, cfg.IngesterMetadataStreaming, cfg.IngesterLabelNamesWithMatchers, batch.NewChunkMergeIterator, cfg.QueryIngestersWithin) tCases := []struct { name string @@ -442,7 +442,7 @@ func TestLimits(t *testing.T) { response: &streamResponse, } - distributorQueryableStreaming := newDistributorQueryable(distributor, cfg.IngesterMetadataStreaming, batch.NewChunkMergeIterator, cfg.QueryIngestersWithin) + distributorQueryableStreaming := newDistributorQueryable(distributor, cfg.IngesterMetadataStreaming, cfg.IngesterLabelNamesWithMatchers, batch.NewChunkMergeIterator, cfg.QueryIngestersWithin) tCases := []struct { name string @@ -1119,8 +1119,8 @@ func TestQuerier_ValidateQueryTimeRange_MaxQueryLookback(t *testing.T) { t.Run("label names", func(t *testing.T) { distributor := &MockDistributor{} - distributor.On("LabelNames", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) - distributor.On("LabelNamesStream", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) + distributor.On("LabelNames", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) + distributor.On("LabelNamesStream", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return([]string{}, nil) queryable, _, _ := New(cfg, overrides, distributor, queryables, nil, log.NewNopLogger()) q, err := queryable.Querier(util.TimeToMillis(testData.queryStartTime), util.TimeToMillis(testData.queryEndTime)) @@ -1309,10 +1309,10 @@ func (m *errDistributor) LabelValuesForLabelName(context.Context, model.Time, mo func (m *errDistributor) LabelValuesForLabelNameStream(context.Context, model.Time, model.Time, model.LabelName, *storage.LabelHints, ...*labels.Matcher) ([]string, error) { return nil, errDistributorError } -func (m *errDistributor) LabelNames(context.Context, model.Time, model.Time, *storage.LabelHints) ([]string, error) { +func (m *errDistributor) LabelNames(context.Context, model.Time, model.Time, *storage.LabelHints, ...*labels.Matcher) ([]string, error) { return nil, errDistributorError } -func (m *errDistributor) LabelNamesStream(context.Context, model.Time, model.Time, *storage.LabelHints) ([]string, error) { +func (m *errDistributor) LabelNamesStream(context.Context, model.Time, model.Time, *storage.LabelHints, ...*labels.Matcher) ([]string, error) { return nil, errDistributorError } func (m *errDistributor) MetricsForLabelMatchers(ctx context.Context, from, through model.Time, hints *storage.SelectHints, matchers ...*labels.Matcher) ([]model.Metric, error) { @@ -1362,11 +1362,11 @@ func (d *emptyDistributor) LabelValuesForLabelNameStream(context.Context, model. return nil, nil } -func (d *emptyDistributor) LabelNames(context.Context, model.Time, model.Time, *storage.LabelHints) ([]string, error) { +func (d *emptyDistributor) LabelNames(context.Context, model.Time, model.Time, *storage.LabelHints, ...*labels.Matcher) ([]string, error) { return nil, nil } -func (d *emptyDistributor) LabelNamesStream(context.Context, model.Time, model.Time, *storage.LabelHints) ([]string, error) { +func (d *emptyDistributor) LabelNamesStream(context.Context, model.Time, model.Time, *storage.LabelHints, ...*labels.Matcher) ([]string, error) { return nil, nil } diff --git a/pkg/querier/testutils.go b/pkg/querier/testutils.go index 67917b0c18..478e61ff0c 100644 --- a/pkg/querier/testutils.go +++ b/pkg/querier/testutils.go @@ -41,12 +41,12 @@ func (m *MockDistributor) LabelValuesForLabelNameStream(ctx context.Context, fro args := m.Called(ctx, from, to, lbl, hints, matchers) return args.Get(0).([]string), args.Error(1) } -func (m *MockDistributor) LabelNames(ctx context.Context, from, to model.Time, hints *storage.LabelHints) ([]string, error) { - args := m.Called(ctx, from, to, hints) +func (m *MockDistributor) LabelNames(ctx context.Context, from, to model.Time, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error) { + args := m.Called(ctx, from, to, hints, matchers) return args.Get(0).([]string), args.Error(1) } -func (m *MockDistributor) LabelNamesStream(ctx context.Context, from, to model.Time, hints *storage.LabelHints) ([]string, error) { - args := m.Called(ctx, from, to, hints) +func (m *MockDistributor) LabelNamesStream(ctx context.Context, from, to model.Time, hints *storage.LabelHints, matchers ...*labels.Matcher) ([]string, error) { + args := m.Called(ctx, from, to, hints, matchers) return args.Get(0).([]string), args.Error(1) } func (m *MockDistributor) MetricsForLabelMatchers(ctx context.Context, from, to model.Time, hints *storage.SelectHints, matchers ...*labels.Matcher) ([]model.Metric, error) {