mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Fix: Exempt "_bucket" suffix from PossibleNonCounterInfo warning (#12982)
Related to PR #12152 Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
7eb01144d1
commit
5c4652c914
|
@ -88,7 +88,11 @@ func extrapolatedRate(vals []parser.Value, args parser.Expressions, enh *EvalNod
|
|||
return enh.Out, annos.Add(annotations.NewMixedFloatsHistogramsWarning(metricName, args[0].PositionRange()))
|
||||
}
|
||||
|
||||
if isCounter && !strings.HasSuffix(metricName, "_total") && !strings.HasSuffix(metricName, "_sum") && !strings.HasSuffix(metricName, "_count") {
|
||||
if isCounter &&
|
||||
!strings.HasSuffix(metricName, "_total") &&
|
||||
!strings.HasSuffix(metricName, "_sum") &&
|
||||
!strings.HasSuffix(metricName, "_count") &&
|
||||
!strings.HasSuffix(metricName, "_bucket") {
|
||||
annos.Add(annotations.NewPossibleNonCounterInfo(metricName, args[0].PositionRange()))
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ var (
|
|||
MixedFloatsHistogramsWarning = fmt.Errorf("%w: encountered a mix of histograms and floats for metric name", PromQLWarning)
|
||||
MixedClassicNativeHistogramsWarning = fmt.Errorf("%w: vector contains a mix of classic and native histograms for metric name", PromQLWarning)
|
||||
|
||||
PossibleNonCounterInfo = fmt.Errorf("%w: metric might not be a counter, name does not end in _total/_sum/_count:", PromQLInfo)
|
||||
PossibleNonCounterInfo = fmt.Errorf("%w: metric might not be a counter, name does not end in _total/_sum/_count/_bucket:", PromQLInfo)
|
||||
HistogramQuantileForcedMonotonicityInfo = fmt.Errorf("%w: input to histogram_quantile needed to be fixed for monotonicity (and may give inaccurate results) for metric name", PromQLInfo)
|
||||
)
|
||||
|
||||
|
@ -157,7 +157,7 @@ func NewMixedClassicNativeHistogramsWarning(metricName string, pos posrange.Posi
|
|||
}
|
||||
|
||||
// NewPossibleNonCounterInfo is used when a counter metric does not have the suffixes
|
||||
// _total, _sum or _count.
|
||||
// _total, _sum, _count, or _bucket.
|
||||
func NewPossibleNonCounterInfo(metricName string, pos posrange.PositionRange) annoErr {
|
||||
return annoErr{
|
||||
PositionRange: pos,
|
||||
|
|
Loading…
Reference in a new issue