prometheus

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 128

Documentation

Overview

Package prometheus provides a Prometheus-based implementation of the MetricFactory abstraction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

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

Counter is a wrapper around a Prometheus Counter or CounterVec object.

func (*Counter) Add

func (m *Counter) Add(val float64, labelVals ...string)

Add adds the given amount to a counter.

func (*Counter) Inc

func (m *Counter) Inc(labelVals ...string)

Inc adds 1 to a counter.

func (*Counter) Value

func (m *Counter) Value(labelVals ...string) float64

Value returns the current amount of a counter.

type Gauge

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

Gauge is a wrapper around a Prometheus Gauge or GaugeVec object.

func (*Gauge) Add

func (m *Gauge) Add(val float64, labelVals ...string)

Add adds given value to a gauge.

func (*Gauge) Dec

func (m *Gauge) Dec(labelVals ...string)

Dec subtracts 1 from a gauge.

func (*Gauge) Inc

func (m *Gauge) Inc(labelVals ...string)

Inc adds 1 to a gauge.

func (*Gauge) Set

func (m *Gauge) Set(val float64, labelVals ...string)

Set sets the value of a gauge.

func (*Gauge) Value

func (m *Gauge) Value(labelVals ...string) float64

Value returns the current amount of a gauge.

type Histogram

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

Histogram is a wrapper around a Prometheus Histogram or HistogramVec object.

func (*Histogram) Info

func (m *Histogram) Info(labelVals ...string) (uint64, float64)

Info returns the count and sum of observations for the histogram.

func (*Histogram) Observe

func (m *Histogram) Observe(val float64, labelVals ...string)

Observe adds a single observation to the histogram.

type MetricFactory

type MetricFactory struct {
	// Prefix is an identifier that will be used before local metric names that
	// are reported. It is strongly recommended that this ends with a valid
	// separator (e.g. "_") in order to improve readability; no separator is
	// added by this library.
	Prefix string
}

MetricFactory allows the creation of Prometheus-based metrics.

func (MetricFactory) NewCounter

func (pmf MetricFactory) NewCounter(name, help string, labelNames ...string) monitoring.Counter

NewCounter creates a new Counter object backed by Prometheus.

func (MetricFactory) NewGauge

func (pmf MetricFactory) NewGauge(name, help string, labelNames ...string) monitoring.Gauge

NewGauge creates a new Gauge object backed by Prometheus.

func (MetricFactory) NewHistogram

func (pmf MetricFactory) NewHistogram(name, help string, labelNames ...string) monitoring.Histogram

NewHistogram creates a new Histogram object backed by Prometheus with the supplied buckets.

func (MetricFactory) NewHistogramWithBuckets added in v1.3.0

func (pmf MetricFactory) NewHistogramWithBuckets(name, help string, buckets []float64, labelNames ...string) monitoring.Histogram

NewHistogramWithBuckets creates a new Histogram object backed by Prometheus and using the supplied bucketing intervals. Note: the number of buckets should be kept within reasonable bounds.

Jump to

Keyboard shortcuts

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