mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Merge pull request #12732 from bboreham/simplify-rangeeval
promql: simplify inner loop of rangeEval
This commit is contained in:
commit
91054875d6
|
@ -1189,41 +1189,24 @@ func (ev *evaluator) rangeEval(prepSeries func(labels.Labels, *EvalSeriesHelper)
|
||||||
}
|
}
|
||||||
|
|
||||||
for si, series := range matrixes[i] {
|
for si, series := range matrixes[i] {
|
||||||
for _, point := range series.Floats {
|
switch {
|
||||||
if point.T == ts {
|
case len(series.Floats) > 0 && series.Floats[0].T == ts:
|
||||||
if ev.currentSamples < ev.maxSamples {
|
vectors[i] = append(vectors[i], Sample{Metric: series.Metric, F: series.Floats[0].F, T: ts})
|
||||||
vectors[i] = append(vectors[i], Sample{Metric: series.Metric, F: point.F, T: ts})
|
// Move input vectors forward so we don't have to re-scan the same
|
||||||
if prepSeries != nil {
|
// past points at the next step.
|
||||||
bufHelpers[i] = append(bufHelpers[i], seriesHelpers[i][si])
|
matrixes[i][si].Floats = series.Floats[1:]
|
||||||
}
|
case len(series.Histograms) > 0 && series.Histograms[0].T == ts:
|
||||||
|
vectors[i] = append(vectors[i], Sample{Metric: series.Metric, H: series.Histograms[0].H, T: ts})
|
||||||
// Move input vectors forward so we don't have to re-scan the same
|
matrixes[i][si].Histograms = series.Histograms[1:]
|
||||||
// past points at the next step.
|
default:
|
||||||
matrixes[i][si].Floats = series.Floats[1:]
|
continue
|
||||||
ev.currentSamples++
|
|
||||||
} else {
|
|
||||||
ev.error(ErrTooManySamples(env))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
for _, point := range series.Histograms {
|
if prepSeries != nil {
|
||||||
if point.T == ts {
|
bufHelpers[i] = append(bufHelpers[i], seriesHelpers[i][si])
|
||||||
if ev.currentSamples < ev.maxSamples {
|
}
|
||||||
vectors[i] = append(vectors[i], Sample{Metric: series.Metric, H: point.H, T: ts})
|
ev.currentSamples++
|
||||||
if prepSeries != nil {
|
if ev.currentSamples > ev.maxSamples {
|
||||||
bufHelpers[i] = append(bufHelpers[i], seriesHelpers[i][si])
|
ev.error(ErrTooManySamples(env))
|
||||||
}
|
|
||||||
|
|
||||||
// Move input vectors forward so we don't have to re-scan the same
|
|
||||||
// past points at the next step.
|
|
||||||
matrixes[i][si].Histograms = series.Histograms[1:]
|
|
||||||
ev.currentSamples++
|
|
||||||
} else {
|
|
||||||
ev.error(ErrTooManySamples(env))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args[i] = vectors[i]
|
args[i] = vectors[i]
|
||||||
|
|
Loading…
Reference in a new issue