Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit a1fe022

Browse files
committed
pr changes
1 parent 906a922 commit a1fe022

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

expr/func_scaletoseconds.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ func (s *FuncScaleToSeconds) Exec(cache map[Req][]models.Series) ([]models.Serie
5454
factor := float64(s.seconds) / float64(serie.Interval)
5555
for _, p := range serie.Datapoints {
5656
if !math.IsNaN(p.Val) {
57-
p.Val = math.Round(p.Val*factor*1000000) / 1000000 // round to 6 decimal places
57+
// round to 6 decimal places to mimic graphite
58+
roundingFactor := math.Pow(10, 6)
59+
p.Val = math.Round(p.Val*factor*roundingFactor) / roundingFactor
5860
}
5961
transformed.Datapoints = append(transformed.Datapoints, p)
6062
}
61-
cache[Req{}] = append(cache[Req{}], *transformed)
6263
}
63-
64+
cache[Req{}] = append(cache[Req{}], out...)
6465
return out, nil
6566
}

0 commit comments

Comments
 (0)