mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
Use labels.Len() instead of manually counting the labels
Signed-off-by: gotjosh <josue.abreu@gmail.com>
This commit is contained in:
parent
ccfafae36d
commit
63b09944b8
|
@ -711,16 +711,12 @@ func TestQueryForStateSeries(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
sample := rule.forStateSample(nil, time.Time{}, 0)
|
sample := rule.forStateSample(nil, time.Time{}, 0)
|
||||||
var matchersCount int
|
|
||||||
sample.Metric.Range(func(l labels.Label) {
|
|
||||||
matchersCount++
|
|
||||||
})
|
|
||||||
|
|
||||||
seriesSet, err := rule.QueryForStateSeries(context.Background(), querier)
|
seriesSet, err := rule.QueryForStateSeries(context.Background(), querier)
|
||||||
|
|
||||||
var series storage.Series
|
var series storage.Series
|
||||||
for seriesSet.Next() {
|
for seriesSet.Next() {
|
||||||
if seriesSet.At().Labels().Len() == matchersCount {
|
if seriesSet.At().Labels().Len() == sample.Metric.Len() {
|
||||||
series = seriesSet.At()
|
series = seriesSet.At()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue