Skip to content

Commit 63537ea

Browse files
authored
Merge pull request #54 from grafana/upgrade-upstream
Upgrade Prometheus upstream
2 parents 16e2a6a + 8e743bb commit 63537ea

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

promql/value.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ func (s Series) String() string {
7777
}
7878

7979
// Point represents a single data point for a given timestamp.
80-
//
81-
// Note that Point's JSON marshaling is done in an optimized fashion in
82-
// web/api/v1/api.go. Therefore, no MarshalJSON method is provided here.
8380
type Point struct {
8481
T int64
8582
V float64
@@ -90,6 +87,12 @@ func (p Point) String() string {
9087
return fmt.Sprintf("%v @[%v]", v, p.T)
9188
}
9289

90+
// MarshalJSON implements json.Marshaler.
91+
func (p Point) MarshalJSON() ([]byte, error) {
92+
v := strconv.FormatFloat(p.V, 'f', -1, 64)
93+
return json.Marshal([...]interface{}{float64(p.T) / 1000, v})
94+
}
95+
9396
// Sample is a single sample belonging to a metric.
9497
type Sample struct {
9598
Point

0 commit comments

Comments
 (0)