mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-21 03:16:00 -08:00
promql: simplify rangeEval a bit more
We can't have both a float and a histogram at the same timestep. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
3879488476
commit
5ce990cabc
|
@ -1187,25 +1187,22 @@ func (ev *evaluator) rangeEval(prepSeries func(labels.Labels, *EvalSeriesHelper)
|
||||||
bufHelpers[i] = bufHelpers[i][:0]
|
bufHelpers[i] = bufHelpers[i][:0]
|
||||||
}
|
}
|
||||||
|
|
||||||
add := func(si int, s Sample) {
|
for si, series := range matrixes[i] {
|
||||||
vectors[i] = append(vectors[i], s)
|
if len(series.Floats) > 0 && series.Floats[0].T == ts {
|
||||||
|
vectors[i] = append(vectors[i], Sample{Metric: series.Metric, F: series.Floats[0].F, T: ts})
|
||||||
|
// Move input vectors forward so we don't have to re-scan the same
|
||||||
|
// past points at the next step.
|
||||||
|
matrixes[i][si].Floats = series.Floats[1:]
|
||||||
|
} else if 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})
|
||||||
|
matrixes[i][si].Histograms = series.Histograms[1:]
|
||||||
|
} else {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if prepSeries != nil {
|
if prepSeries != nil {
|
||||||
bufHelpers[i] = append(bufHelpers[i], seriesHelpers[i][si])
|
bufHelpers[i] = append(bufHelpers[i], seriesHelpers[i][si])
|
||||||
}
|
}
|
||||||
ev.currentSamples++
|
ev.currentSamples++
|
||||||
}
|
|
||||||
|
|
||||||
for si, series := range matrixes[i] {
|
|
||||||
if len(series.Floats) > 0 && series.Floats[0].T == ts {
|
|
||||||
add(si, Sample{Metric: series.Metric, F: series.Floats[0].F, T: ts})
|
|
||||||
// Move input vectors forward so we don't have to re-scan the same
|
|
||||||
// past points at the next step.
|
|
||||||
matrixes[i][si].Floats = series.Floats[1:]
|
|
||||||
}
|
|
||||||
if len(series.Histograms) > 0 && series.Histograms[0].T == ts {
|
|
||||||
add(si, Sample{Metric: series.Metric, H: series.Histograms[0].H, T: ts})
|
|
||||||
matrixes[i][si].Histograms = series.Histograms[1:]
|
|
||||||
}
|
|
||||||
if ev.currentSamples > ev.maxSamples {
|
if ev.currentSamples > ev.maxSamples {
|
||||||
ev.error(ErrTooManySamples(env))
|
ev.error(ErrTooManySamples(env))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue