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

Method UnmarshalJSON

model/value.go:226–246  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

224}
225
226func (ss *SampleStream) UnmarshalJSON(b []byte) error {
227 v := struct {
228 Metric Metric `json:"metric"`
229 Values []SamplePair `json:"values"`
230 Histograms []SampleHistogramPair `json:"histograms"`
231 }{
232 Metric: ss.Metric,
233 Values: ss.Values,
234 Histograms: ss.Histograms,
235 }
236
237 if err := json.Unmarshal(b, &v); err != nil {
238 return err
239 }
240
241 ss.Metric = v.Metric
242 ss.Values = v.Values
243 ss.Histograms = v.Histograms
244
245 return nil
246}
247
248// Scalar is a scalar value evaluated at the set timestamp.
249type Scalar struct {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected