|
|
|
@ -179,15 +179,21 @@ func extrapolatedRate(vals []parser.Value, args parser.Expressions, enh *EvalNod
|
|
|
|
|
// Otherwise, it returns the calculated histogram and an empty annotation.
|
|
|
|
|
func histogramRate(points []HPoint, isCounter bool, metricName string, pos posrange.PositionRange) (*histogram.FloatHistogram, annotations.Annotations) {
|
|
|
|
|
prev := points[0].H
|
|
|
|
|
usingCustomBuckets := prev.UsesCustomBuckets()
|
|
|
|
|
last := points[len(points)-1].H
|
|
|
|
|
if last == nil {
|
|
|
|
|
return nil, annotations.New().Add(annotations.NewMixedFloatsHistogramsWarning(metricName, pos))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
minSchema := prev.Schema
|
|
|
|
|
if last.Schema < minSchema {
|
|
|
|
|
minSchema = last.Schema
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if last.UsesCustomBuckets() != usingCustomBuckets {
|
|
|
|
|
return nil, annotations.New().Add(annotations.NewMixedExponentialCustomHistogramsWarning(metricName, pos))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var annos annotations.Annotations
|
|
|
|
|
|
|
|
|
|
// We check for gauge type histograms in the loop below, but the loop below does not run on the first and last point,
|
|
|
|
@ -215,6 +221,9 @@ func histogramRate(points []HPoint, isCounter bool, metricName string, pos posra
|
|
|
|
|
if curr.Schema < minSchema {
|
|
|
|
|
minSchema = curr.Schema
|
|
|
|
|
}
|
|
|
|
|
if curr.UsesCustomBuckets() != usingCustomBuckets {
|
|
|
|
|
return nil, annotations.New().Add(annotations.NewMixedExponentialCustomHistogramsWarning(metricName, pos))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h := last.CopyToSchema(minSchema)
|
|
|
|
|