mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04:05 -08:00
Restore more efficient version of NewPossibleNonCounterInfo annotation (#13022)
Restore more efficient version of NewPossibleNonCounterInfo annotation Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com> --------- Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
parent
b695e069b8
commit
72a8f1084b
|
@ -24,6 +24,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -1543,6 +1544,18 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, annotations.Annotatio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ev.samplesStats.UpdatePeak(ev.currentSamples)
|
ev.samplesStats.UpdatePeak(ev.currentSamples)
|
||||||
|
|
||||||
|
if e.Func.Name == "rate" || e.Func.Name == "increase" {
|
||||||
|
samples := inMatrix[0]
|
||||||
|
metricName := samples.Metric.Get(labels.MetricName)
|
||||||
|
if metricName != "" && len(samples.Floats) > 0 &&
|
||||||
|
!strings.HasSuffix(metricName, "_total") &&
|
||||||
|
!strings.HasSuffix(metricName, "_sum") &&
|
||||||
|
!strings.HasSuffix(metricName, "_count") &&
|
||||||
|
!strings.HasSuffix(metricName, "_bucket") {
|
||||||
|
warnings.Add(annotations.NewPossibleNonCounterInfo(metricName, e.Args[0].PositionRange()))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ev.samplesStats.UpdatePeak(ev.currentSamples)
|
ev.samplesStats.UpdatePeak(ev.currentSamples)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue