Skip to content

Commit

Permalink
set label matchers in LabelValueRequest
Browse files Browse the repository at this point in the history
Signed-off-by: Mauro Stettler <[email protected]>
  • Loading branch information
replay committed Feb 15, 2021
1 parent 688dc72 commit 231f7ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/query/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,24 @@ func sortDedupLabels(set []storepb.Series, replicaLabels map[string]struct{}) {
}

// LabelValues returns all potential values for a label name.
func (q *querier) LabelValues(name string) ([]string, storage.Warnings, error) {
func (q *querier) LabelValues(name string, matchers ...*labels.Matcher) ([]string, storage.Warnings, error) {
span, ctx := tracing.StartSpan(q.ctx, "querier_label_values")
defer span.Finish()

// TODO(bwplotka): Pass it using the SeriesRequest instead of relying on context.
ctx = context.WithValue(ctx, store.StoreMatcherKey, q.storeDebugMatchers)

pbMatchers, err := storepb.PromMatchersToMatchers(matchers...)
if err != nil {
return nil, nil, errors.Wrap(err, "proxy LabelValues()")
}

resp, err := q.proxy.LabelValues(ctx, &storepb.LabelValuesRequest{
Label: name,
PartialResponseDisabled: !q.partialResponse,
Start: q.mint,
End: q.maxt,
LabelMatchers: pbMatchers,
})
if err != nil {
return nil, nil, errors.Wrap(err, "proxy LabelValues()")
Expand Down

0 comments on commit 231f7ad

Please sign in to comment.