go-graphite / carbonapi

Implementation of graphite API (graphite-web) in golang
Other
309 stars 140 forks source link

Fix summarize() function handling of intervals #767

Closed carrieedwards closed 1 year ago

carrieedwards commented 1 year ago

An issue has been discovered with the summarize() function in which, when interval parameter passed into summarize() was set to a value smaller than the fetched data's step between data points, it results were incorrect. The results were a copy of the data points for each series in the list. For example:

summarize(metric1,'5s') []*types.MetricData("metric1", []float64{1, 2, 3, 4, 5}, 10, now32)} // 10s step

The result was []float64{1, 2, 3, 4 5}. Issuing the same query with the same data in Graphite-web yielded results of [1, None, 2, Non, 3, None, 4, None, 5, None, None]. This is due to the interval being smaller than the step, and therefore some resulting values will be NaN.