Browse Source
* WIP persisting time series viewer metrics. Closes #1478 * Remove unused var, move around initial collectionpull/1703/head
6 changed files with 69 additions and 21 deletions
@ -1,8 +1,21 @@ |
|||||||
package metrics |
package metrics |
||||||
|
|
||||||
import "time" |
import ( |
||||||
|
"time" |
||||||
|
|
||||||
|
"github.com/nakabonne/tstorage" |
||||||
|
) |
||||||
|
|
||||||
type timestampedValue struct { |
type timestampedValue struct { |
||||||
Time time.Time `json:"time"` |
Time time.Time `json:"time"` |
||||||
Value int `json:"value"` |
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 |
||||||
|
} |
||||||
|
Loading…
Reference in new issue