Expressions: Field names from refId (#29755)

so one can see which expression data came from when visualizing
This commit is contained in:
Kyle Brandt
2020-12-11 06:59:12 -05:00
committed by GitHub
parent a515c54404
commit 67372378ac
14 changed files with 100 additions and 98 deletions
+2 -2
View File
@@ -9,12 +9,12 @@ import (
)
// Resample turns the Series into a Number based on the given reduction function
func (s Series) Resample(interval time.Duration, downsampler string, upsampler string, tr backend.TimeRange) (Series, error) {
func (s Series) Resample(refID string, interval time.Duration, downsampler string, upsampler string, tr backend.TimeRange) (Series, error) {
newSeriesLength := int(float64(tr.To.Sub(tr.From).Nanoseconds()) / float64(interval.Nanoseconds()))
if newSeriesLength <= 0 {
return s, fmt.Errorf("the series cannot be sampled further; the time range is shorter than the interval")
}
resampled := NewSeries(s.GetName(), s.GetLabels(), s.TimeIdx, s.TimeIsNullable, s.ValueIdx, s.ValueIsNullabe, newSeriesLength+1)
resampled := NewSeries(refID, s.GetLabels(), s.TimeIdx, s.TimeIsNullable, s.ValueIdx, s.ValueIsNullabe, newSeriesLength+1)
bookmark := 0
var lastSeen *float64
idx := 0