Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (26 sloc) 522 Bytes
package graphite
import (
"fmt"
"time"
)
// Metric is a struct that defines the relevant properties of a graphite metric
type Metric struct {
Name string
Value string
Timestamp int64
}
func NewMetric(name, value string, timestamp int64) Metric {
return Metric{
Name: name,
Value: value,
Timestamp: timestamp,
}
}
func (metric Metric) String() string {
return fmt.Sprintf(
"%s %s %s",
metric.Name,
metric.Value,
time.Unix(metric.Timestamp, 0).Format("2006-01-02 15:04:05"),
)
}