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

Function NewCounterFunc

prometheus/counter.go:351–358  ·  view source on GitHub ↗

NewCounterFunc creates a new CounterFunc based on the provided CounterOpts. The value reported is determined by calling the given function from within the Write method. Take into account that metric collection may happen concurrently. If that results in concurrent calls to Write, like in the case wh

(opts CounterOpts, function func() float64)

Source from the content-addressed store, hash-verified

349//
350// Check out the ExampleGaugeFunc examples for the similar GaugeFunc.
351func NewCounterFunc(opts CounterOpts, function func() float64) CounterFunc {
352 return newValueFunc(NewDesc(
353 BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
354 opts.Help,
355 nil,
356 opts.ConstLabels,
357 ), CounterValue, function)
358}

Callers 1

NewCounterFuncMethod · 0.92

Calls 3

newValueFuncFunction · 0.85
NewDescFunction · 0.85
BuildFQNameFunction · 0.85

Tested by

no test coverage detected