Skip to content

Commit

Permalink
Query Label Names and Values from blocks store (#3520)
Browse files Browse the repository at this point in the history
* Query Label Names from blocks store

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

* Query Label Values from block store

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

* Address feedback and unit tests for label names

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

* Add unit test for LabelValues

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

* Address feedback

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
  • Loading branch information
gouthamve authored and aknuds1 committed Sep 1, 2021
1 parent 70e0bde commit 0c7c2eb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ func (d *Distributor) LabelValuesForLabelName(ctx context.Context, from, to mode
for v := range valueSet {
values = append(values, v)
}

// We need the values returned to be sorted.
sort.Strings(values)

return values, nil
}

Expand Down Expand Up @@ -704,9 +708,8 @@ func (d *Distributor) LabelNames(ctx context.Context, from, to model.Time) ([]st
for v := range valueSet {
values = append(values, v)
}
sort.Slice(values, func(i, j int) bool {
return values[i] < values[j]
})

sort.Strings(values)

return values, nil
}
Expand Down

0 comments on commit 0c7c2eb

Please sign in to comment.