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

Method With

prometheus/summary.go:658–664  ·  view source on GitHub ↗

With works as GetMetricWith, but panics where GetMetricWithLabels would have returned an error. Not returning an error allows shortcuts like myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21)

(labels Labels)

Source from the content-addressed store, hash-verified

656//
657// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21)
658func (v *SummaryVec) With(labels Labels) Observer {
659 s, err := v.GetMetricWith(labels)
660 if err != nil {
661 panic(err)
662 }
663 return s
664}
665
666// CurryWith returns a vector curried with the provided labels, i.e. the
667// returned vector has those labels pre-set for all labeled operations performed

Callers 1

TestWriteToTextfileFunction · 0.95

Calls 1

GetMetricWithMethod · 0.95

Tested by 1

TestWriteToTextfileFunction · 0.76