You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
415 B
21 lines
415 B
package metrics |
|
|
|
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 |
|
}
|
|
|