extprom

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TxGaugeVec

type TxGaugeVec struct {
	// contains filtered or unexported fields
}

func NewTxGaugeVec

func NewTxGaugeVec(reg prometheus.Registerer, opts prometheus.GaugeOpts, labelNames []string, initLabelValues ...[]string) *TxGaugeVec

NewTxGaugeVec is a prometheus.GaugeVec that allows to start atomic metric value transaction. It might be useful if long process that wants to update a GaugeVec but wants to build/accumulate those metrics in a concurrent way without exposing partial state to Prometheus. Caller can also use this as normal GaugeVec.

Additionally it allows to init LabelValues on each transaction. NOTE: This is quite naive implementation creating new prometheus.GaugeVec on each `ResetTx`, use wisely.

func (*TxGaugeVec) Collect

func (tx *TxGaugeVec) Collect(ch chan<- prometheus.Metric)

Collect is used by Registered.

func (*TxGaugeVec) Describe

func (tx *TxGaugeVec) Describe(ch chan<- *prometheus.Desc)

Describe is used in Register.

func (*TxGaugeVec) ResetTx

func (tx *TxGaugeVec) ResetTx()

ResetTx starts new transaction. Not goroutine-safe.

func (*TxGaugeVec) Submit

func (tx *TxGaugeVec) Submit()

Submit atomically and fully applies new values from existing transaction GaugeVec. Not goroutine-safe.

func (*TxGaugeVec) With

func (tx *TxGaugeVec) With(labels prometheus.Labels) prometheus.Gauge

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"}).Add(42)

func (*TxGaugeVec) WithLabelValues

func (tx *TxGaugeVec) WithLabelValues(lvs ...string) prometheus.Gauge

WithLabelValues works as GetMetricWithLabelValues, but panics where GetMetricWithLabelValues would have returned an error. Not returning an error allows shortcuts like

myVec.WithLabelValues("404", "GET").Add(42)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL