NewGaugeFunc creates a new GaugeFunc based on the provided GaugeOpts. The value reported is determined by calling the given function from within the Write method. Take into account that metric collection may happen concurrently. Therefore, it must be safe to call the provided function concurrently.
(opts GaugeOpts, function func() float64)
| 302 | // value of 1. Example: |
| 303 | // https://github.com/prometheus/common/blob/8558a5b7db3c84fa38b4766966059a7bd5bfa2ee/version/info.go#L36-L56 |
| 304 | func NewGaugeFunc(opts GaugeOpts, function func() float64) GaugeFunc { |
| 305 | return newValueFunc(NewDesc( |
| 306 | BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), |
| 307 | opts.Help, |
| 308 | nil, |
| 309 | opts.ConstLabels, |
| 310 | ), GaugeValue, function) |
| 311 | } |