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.
22 lines
459 B
22 lines
459 B
package metrics |
|
|
|
import ( |
|
"time" |
|
|
|
"github.com/nakabonne/tstorage" |
|
) |
|
|
|
// TimestampedValue is a value with a timestamp. |
|
type TimestampedValue struct { |
|
Time time.Time `json:"time"` |
|
Value float64 `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: d.Value}) |
|
} |
|
|
|
return tv |
|
}
|
|
|