MCPcopy Create free account
hub / github.com/prometheus/common / MarshalJSON

Method MarshalJSON

model/value_float.go:72–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72func (s SamplePair) MarshalJSON() ([]byte, error) {
73 t, err := json.Marshal(s.Timestamp)
74 if err != nil {
75 return nil, err
76 }
77 v, err := json.Marshal(s.Value)
78 if err != nil {
79 return nil, err
80 }
81 return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil
82}
83
84// UnmarshalJSON implements json.Unmarshaler.
85func (s *SamplePair) UnmarshalJSON(b []byte) error {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected