mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Add metrics to result after checking all matchers
Should be marginally faster and somewhat more GC friendly
This commit is contained in:
parent
bedc0eda1f
commit
c048a0cde8
|
@ -631,19 +631,22 @@ func (s *MemorySeriesStorage) metricsForLabelMatchers(
|
||||||
}
|
}
|
||||||
|
|
||||||
result := map[model.Fingerprint]metric.Metric{}
|
result := map[model.Fingerprint]metric.Metric{}
|
||||||
|
FP_LOOP:
|
||||||
for fp := range remainingFPs {
|
for fp := range remainingFPs {
|
||||||
s.fpLocker.Lock(fp)
|
s.fpLocker.Lock(fp)
|
||||||
if met, _, ok := s.metricForRange(fp, from, through); ok {
|
met, _, ok := s.metricForRange(fp, from, through)
|
||||||
result[fp] = metric.Metric{Metric: met}
|
|
||||||
}
|
|
||||||
s.fpLocker.Unlock(fp)
|
s.fpLocker.Unlock(fp)
|
||||||
}
|
|
||||||
for _, m := range matchers[matcherIdx:] {
|
if !ok {
|
||||||
for fp, met := range result {
|
continue FP_LOOP
|
||||||
if !m.Match(met.Metric[m.Name]) {
|
}
|
||||||
delete(result, fp)
|
|
||||||
|
for _, m := range matchers[matcherIdx:] {
|
||||||
|
if !m.Match(met[m.Name]) {
|
||||||
|
continue FP_LOOP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result[fp] = metric.Metric{Metric: met}
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue