Browse Source

Merge pull request #12988 from zenador/release-2.48-fix-non-counter-warning

Fix possible non-counter warning for empty names and native histograms
pull/12994/head^2
Björn Rabenstein 1 year ago committed by GitHub
parent
commit
fb0b9fc0da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      promql/functions.go
  2. 4
      util/annotations/annotations.go

2
promql/functions.go

@ -88,7 +88,7 @@ func extrapolatedRate(vals []parser.Value, args parser.Expressions, enh *EvalNod
return enh.Out, annos.Add(annotations.NewMixedFloatsHistogramsWarning(metricName, args[0].PositionRange()))
}
if isCounter &&
if isCounter && metricName != "" && len(samples.Floats) > 0 &&
!strings.HasSuffix(metricName, "_total") &&
!strings.HasSuffix(metricName, "_sum") &&
!strings.HasSuffix(metricName, "_count") &&

4
util/annotations/annotations.go

@ -156,8 +156,8 @@ func NewMixedClassicNativeHistogramsWarning(metricName string, pos posrange.Posi
}
}
// NewPossibleNonCounterInfo is used when a counter metric does not have the suffixes
// _total, _sum, _count, or _bucket.
// NewPossibleNonCounterInfo is used when a named counter metric with only float samples does not
// have the suffixes _total, _sum, _count, or _bucket.
func NewPossibleNonCounterInfo(metricName string, pos posrange.PositionRange) annoErr {
return annoErr{
PositionRange: pos,

Loading…
Cancel
Save