MCPcopy
hub / github.com/prometheus/client_golang / MustNewConstMetric

Function MustNewConstMetric

prometheus/value.go:126–132  ·  view source on GitHub ↗

MustNewConstMetric is a version of NewConstMetric that panics where NewConstMetric would have returned an error.

(desc *Desc, valueType ValueType, value float64, labelValues ...string)

Source from the content-addressed store, hash-verified

124// MustNewConstMetric is a version of NewConstMetric that panics where
125// NewConstMetric would have returned an error.
126func MustNewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) Metric {
127 m, err := NewConstMetric(desc, valueType, value, labelValues...)
128 if err != nil {
129 panic(err)
130 }
131 return m
132}
133
134// NewConstMetricWithCreatedTimestamp does the same thing as NewConstMetric, but generates Counters
135// with created timestamp set and returns an error for other metric types.

Callers 15

CollectMethod · 0.92
ExampleCollectorFuncFunction · 0.92
CollectMethod · 0.92
CollectMethod · 0.92
CollectMethod · 0.85
CollectMethod · 0.85
processCollectMethod · 0.85
processCollectMethod · 0.85
NewBuildInfoCollectorFunction · 0.85
msCollectMethod · 0.85

Calls 1

NewConstMetricFunction · 0.85

Tested by 8

CollectMethod · 0.74
ExampleCollectorFuncFunction · 0.74
CollectMethod · 0.74
TestCollectorFuncFunction · 0.68