mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
Merge pull request #9866 from prometheus/beorn7/cleanup
Promql: Add clarifying note to Point.MarshalJSON
This commit is contained in:
commit
e63b85be4f
|
@ -88,6 +88,14 @@ func (p Point) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON implements json.Marshaler.
|
// MarshalJSON implements json.Marshaler.
|
||||||
|
//
|
||||||
|
// JSON marshaling is only needed for the HTTP API. Since Point is such a
|
||||||
|
// frequently marshaled type, it gets an optimized treatment directly in
|
||||||
|
// web/api/v1/api.go. Therefore, this method is unused within Prometheus. It is
|
||||||
|
// still provided here as convenience for debugging and for other users of this
|
||||||
|
// code. Also note that the different marshaling implementations might lead to
|
||||||
|
// slightly different results in terms of formatting and rounding of the
|
||||||
|
// timestamp.
|
||||||
func (p Point) MarshalJSON() ([]byte, error) {
|
func (p Point) MarshalJSON() ([]byte, error) {
|
||||||
v := strconv.FormatFloat(p.V, 'f', -1, 64)
|
v := strconv.FormatFloat(p.V, 'f', -1, 64)
|
||||||
return json.Marshal([...]interface{}{float64(p.T) / 1000, v})
|
return json.Marshal([...]interface{}{float64(p.T) / 1000, v})
|
||||||
|
|
Loading…
Reference in a new issue