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

Method WithLabelValues

prometheus/summary.go:646–652  ·  view source on GitHub ↗

WithLabelValues works as GetMetricWithLabelValues, but panics where GetMetricWithLabelValues would have returned an error. Not returning an error allows shortcuts like myVec.WithLabelValues("404", "GET").Observe(42.21)

(lvs ...string)

Source from the content-addressed store, hash-verified

644//
645// myVec.WithLabelValues("404", "GET").Observe(42.21)
646func (v *SummaryVec) WithLabelValues(lvs ...string) Observer {
647 s, err := v.GetMetricWithLabelValues(lvs...)
648 if err != nil {
649 panic(err)
650 }
651 return s
652}
653
654// With works as GetMetricWith, but panics where GetMetricWithLabels would have
655// returned an error. Not returning an error allows shortcuts like

Callers 5

ExampleSummaryVecFunction · 0.95
testWriteSummaryFunction · 0.95

Calls 1

Tested by 5

ExampleSummaryVecFunction · 0.76
testWriteSummaryFunction · 0.76