extprom

package
v0.23.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 7 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentGaugeValuesFor added in v0.11.0

func CurrentGaugeValuesFor(t *testing.T, reg prometheus.Gatherer, metricNames ...string) map[string]float64

CurrentGaugeValuesFor returns gauge values for given metric names. Useful for testing based on registry, when you don't have access to metric variable.

func WrapRegistererWith added in v0.7.0

func WrapRegistererWith(labels prometheus.Labels, reg prometheus.Registerer) prometheus.Registerer

WrapRegistererWith is like prometheus.WrapRegistererWith but it passes nil straight through which allows nil check.

func WrapRegistererWithPrefix added in v0.7.0

func WrapRegistererWithPrefix(prefix string, reg prometheus.Registerer) prometheus.Registerer

WrapRegistererWithPrefix is like prometheus.WrapRegistererWithPrefix but it passes nil straight through which allows nil check.

Types

type TxGaugeVec added in v0.10.0

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

func NewTxGaugeVec added in v0.10.0

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 added in v0.10.0

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

Collect is used by Registered.

func (*TxGaugeVec) Describe added in v0.10.0

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

Describe is used in Register.

func (*TxGaugeVec) ResetTx added in v0.10.0

func (tx *TxGaugeVec) ResetTx()

ResetTx starts new transaction. Not goroutine-safe.

func (*TxGaugeVec) Submit added in v0.10.0

func (tx *TxGaugeVec) Submit()

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

func (*TxGaugeVec) With added in v0.10.0

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 added in v0.10.0

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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