Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
(cherry picked from commit 4093fae99a)
Co-authored-by: Kyle Brandt <kyle@grafana.com>
This commit is contained in:
co-authored by
Kyle Brandt
parent
0924f4e268
commit
d97bc8c0a9
@@ -38,7 +38,7 @@ func (cr classicReducer) Reduce(series mathexp.Series) mathexp.Number {
|
||||
value := float64(0)
|
||||
allNull := true
|
||||
|
||||
vF := series.Frame.Fields[series.ValueIdx]
|
||||
vF := series.Frame.Fields[1]
|
||||
ff := mathexp.Float64Field(*vF)
|
||||
|
||||
switch cr {
|
||||
|
||||
@@ -399,9 +399,9 @@ func TestPercentDiffAbsReducer(t *testing.T) {
|
||||
}
|
||||
|
||||
func valBasedSeries(vals ...*float64) mathexp.Series {
|
||||
newSeries := mathexp.NewSeries("", nil, 0, false, 1, true, len(vals))
|
||||
newSeries := mathexp.NewSeries("", nil, len(vals))
|
||||
for idx, f := range vals {
|
||||
err := newSeries.SetPoint(idx, unixTimePointer(int64(idx)), f)
|
||||
err := newSeries.SetPoint(idx, time.Unix(int64(idx), 0), f)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -410,9 +410,9 @@ func valBasedSeries(vals ...*float64) mathexp.Series {
|
||||
}
|
||||
|
||||
func valBasedSeriesWithLabels(l data.Labels, vals ...*float64) mathexp.Series {
|
||||
newSeries := mathexp.NewSeries("", l, 0, false, 1, true, len(vals))
|
||||
newSeries := mathexp.NewSeries("", l, len(vals))
|
||||
for idx, f := range vals {
|
||||
err := newSeries.SetPoint(idx, unixTimePointer(int64(idx)), f)
|
||||
err := newSeries.SetPoint(idx, time.Unix(int64(idx), 0), f)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -420,11 +420,6 @@ func valBasedSeriesWithLabels(l data.Labels, vals ...*float64) mathexp.Series {
|
||||
return newSeries
|
||||
}
|
||||
|
||||
func unixTimePointer(sec int64) *time.Time {
|
||||
t := time.Unix(sec, 0)
|
||||
return &t
|
||||
}
|
||||
|
||||
func valBasedNumber(f *float64) mathexp.Number {
|
||||
newNumber := mathexp.NewNumber("", nil)
|
||||
newNumber.SetValue(f)
|
||||
|
||||
Reference in New Issue
Block a user