mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Continue avoiding creating empty annotations as much as possible
This commit is contained in:
parent
a9f19da42e
commit
48e64fdd4d
|
@ -2536,7 +2536,7 @@ type groupedAggregation struct {
|
||||||
func (ev *evaluator) aggregation(e *parser.AggregateExpr, grouping []string, param interface{}, vec Vector, seriesHelper []EvalSeriesHelper, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
|
func (ev *evaluator) aggregation(e *parser.AggregateExpr, grouping []string, param interface{}, vec Vector, seriesHelper []EvalSeriesHelper, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
|
||||||
op := e.Op
|
op := e.Op
|
||||||
without := e.Without
|
without := e.Without
|
||||||
annos := annotations.Annotations{}
|
var annos annotations.Annotations
|
||||||
result := map[uint64]*groupedAggregation{}
|
result := map[uint64]*groupedAggregation{}
|
||||||
orderedResult := []*groupedAggregation{}
|
orderedResult := []*groupedAggregation{}
|
||||||
var k int64
|
var k int64
|
||||||
|
|
|
@ -85,7 +85,6 @@ func extrapolatedRate(vals []parser.Value, args parser.Expressions, enh *EvalNod
|
||||||
// Vector element.
|
// Vector element.
|
||||||
metricName := samples.Metric.Get(labels.MetricName)
|
metricName := samples.Metric.Get(labels.MetricName)
|
||||||
if len(samples.Histograms) > 0 && len(samples.Floats) > 0 {
|
if len(samples.Histograms) > 0 && len(samples.Floats) > 0 {
|
||||||
annos := annotations.Annotations{}
|
|
||||||
return enh.Out, annos.Add(annotations.NewMixedFloatsHistogramsWarning(metricName, args[0].PositionRange()))
|
return enh.Out, annos.Add(annotations.NewMixedFloatsHistogramsWarning(metricName, args[0].PositionRange()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +96,6 @@ func extrapolatedRate(vals []parser.Value, args parser.Expressions, enh *EvalNod
|
||||||
var newAnnos annotations.Annotations
|
var newAnnos annotations.Annotations
|
||||||
resultHistogram, newAnnos = histogramRate(samples.Histograms, isCounter, metricName, args[0].PositionRange())
|
resultHistogram, newAnnos = histogramRate(samples.Histograms, isCounter, metricName, args[0].PositionRange())
|
||||||
if resultHistogram == nil {
|
if resultHistogram == nil {
|
||||||
annos := annotations.Annotations{}
|
|
||||||
// The histograms are not compatible with each other.
|
// The histograms are not compatible with each other.
|
||||||
return enh.Out, annos.Merge(newAnnos)
|
return enh.Out, annos.Merge(newAnnos)
|
||||||
}
|
}
|
||||||
|
@ -636,7 +634,7 @@ func funcQuantileOverTime(vals []parser.Value, args parser.Expressions, enh *Eva
|
||||||
return enh.Out, nil
|
return enh.Out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
annos := annotations.Annotations{}
|
var annos annotations.Annotations
|
||||||
if math.IsNaN(q) || q < 0 || q > 1 {
|
if math.IsNaN(q) || q < 0 || q > 1 {
|
||||||
annos.Add(annotations.NewInvalidQuantileWarning(q, args[0].PositionRange()))
|
annos.Add(annotations.NewInvalidQuantileWarning(q, args[0].PositionRange()))
|
||||||
}
|
}
|
||||||
|
@ -1099,7 +1097,7 @@ func funcHistogramFraction(vals []parser.Value, args parser.Expressions, enh *Ev
|
||||||
func funcHistogramQuantile(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
|
func funcHistogramQuantile(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) (Vector, annotations.Annotations) {
|
||||||
q := vals[0].(Vector)[0].F
|
q := vals[0].(Vector)[0].F
|
||||||
inVec := vals[1].(Vector)
|
inVec := vals[1].(Vector)
|
||||||
annos := annotations.Annotations{}
|
var annos annotations.Annotations
|
||||||
|
|
||||||
if math.IsNaN(q) || q < 0 || q > 1 {
|
if math.IsNaN(q) || q < 0 || q > 1 {
|
||||||
annos.Add(annotations.NewInvalidQuantileWarning(q, args[0].PositionRange()))
|
annos.Add(annotations.NewInvalidQuantileWarning(q, args[0].PositionRange()))
|
||||||
|
|
Loading…
Reference in a new issue