This reverts commit 427425cc9f
.
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
This commit is contained in:
parent
1b74a3812e
commit
2a3d62ac84
|
@ -77,9 +77,6 @@ func (s Series) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Point represents a single data point for a given timestamp.
|
// Point represents a single data point for a given timestamp.
|
||||||
//
|
|
||||||
// Note that Point's JSON marshaling is done in an optimized fashion in
|
|
||||||
// web/api/v1/api.go. Therefore, no MarshalJSON method is provided here.
|
|
||||||
type Point struct {
|
type Point struct {
|
||||||
T int64
|
T int64
|
||||||
V float64
|
V float64
|
||||||
|
@ -90,6 +87,12 @@ func (p Point) String() string {
|
||||||
return fmt.Sprintf("%v @[%v]", v, p.T)
|
return fmt.Sprintf("%v @[%v]", v, p.T)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements json.Marshaler.
|
||||||
|
func (p Point) MarshalJSON() ([]byte, error) {
|
||||||
|
v := strconv.FormatFloat(p.V, 'f', -1, 64)
|
||||||
|
return json.Marshal([...]interface{}{float64(p.T) / 1000, v})
|
||||||
|
}
|
||||||
|
|
||||||
// Sample is a single sample belonging to a metric.
|
// Sample is a single sample belonging to a metric.
|
||||||
type Sample struct {
|
type Sample struct {
|
||||||
Point
|
Point
|
||||||
|
|
Loading…
Reference in New Issue