Commit 9659c98d by kay delaney Committed by GitHub

Test Datasource/Bug: Fixes division by zero in csv metric values scenario (#29029)

Closes #8705
parent 8f9e5a83
...@@ -237,7 +237,10 @@ func init() { ...@@ -237,7 +237,10 @@ func init() {
series := newSeriesForQuery(query, 0) series := newSeriesForQuery(query, 0)
startTime := context.TimeRange.GetFromAsMsEpoch() startTime := context.TimeRange.GetFromAsMsEpoch()
endTime := context.TimeRange.GetToAsMsEpoch() endTime := context.TimeRange.GetToAsMsEpoch()
step := (endTime - startTime) / int64(len(values)-1) var step int64 = 0
if len(values) > 1 {
step = (endTime - startTime) / int64(len(values)-1)
}
for _, val := range values { for _, val := range values {
series.Points = append(series.Points, tsdb.TimePoint{val, null.FloatFrom(float64(startTime))}) series.Points = append(series.Points, tsdb.TimePoint{val, null.FloatFrom(float64(startTime))})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment