Persist time series viewer metrics (#1752)
* WIP persisting time series viewer metrics. Closes #1478 * Remove unused var, move around initial collection
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
package metrics
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nakabonne/tstorage"
|
||||
)
|
||||
|
||||
type timestampedValue struct {
|
||||
Time time.Time `json:"time"`
|
||||
Value int `json:"value"`
|
||||
}
|
||||
|
||||
func makeTimestampedValuesFromDatapoints(dp []*tstorage.DataPoint) []timestampedValue {
|
||||
tv := []timestampedValue{}
|
||||
for _, d := range dp {
|
||||
tv = append(tv, timestampedValue{Time: time.Unix(d.Timestamp, 0), Value: int(d.Value)})
|
||||
}
|
||||
|
||||
return tv
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user