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

Method NewCounter

prometheus/promauto/auto.go:262–268  ·  view source on GitHub ↗

NewCounter works like the function of the same name in the prometheus package but it automatically registers the Counter with the Factory's Registerer.

(opts prometheus.CounterOpts)

Source from the content-addressed store, hash-verified

260// NewCounter works like the function of the same name in the prometheus package
261// but it automatically registers the Counter with the Factory's Registerer.
262func (f Factory) NewCounter(opts prometheus.CounterOpts) prometheus.Counter {
263 c := prometheus.NewCounter(opts)
264 if f.r != nil {
265 f.r.MustRegister(c)
266 }
267 return c
268}
269
270// NewCounterVec works like the function of the same name in the prometheus
271// package but it automatically registers the CounterVec with the Factory's

Callers 5

TestNilFunction · 0.80
NewCounterFunction · 0.80
startFireKeeperFunction · 0.80
startSparkForgeFunction · 0.80
runMainFunction · 0.80

Calls 2

NewCounterFunction · 0.92
MustRegisterMethod · 0.65

Tested by 1

TestNilFunction · 0.64