metrics

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MPL-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter[V Value] struct {
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter[V Value](name string, cfg CounterConfig) (_ *Counter[V])

NewCounter creates a new counter metric, without any labels. Use NewCounterGroup for metrics with labels.

func (*Counter[V]) Add

func (*Counter[V]) Add(delta V)

Add adds an arbitrary, non-negative value to the counter. It panics if the delta is < 0.

func (*Counter[V]) Increment

func (*Counter[V]) Increment()

Increment increments the counter by 1.

type CounterConfig

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

CounterConfig configures a counter. It's currently a placeholder as there is not yet any additional configuration.

type CounterGroup

type CounterGroup[L Labels, V Value] struct {
	// contains filtered or unexported fields
}

func NewCounterGroup

func NewCounterGroup[L Labels, V Value](name string, cfg CounterConfig) (_ *CounterGroup[L, V])

NewCounterGroup creates a new counter group with a set of labels, where each unique combination of labels becomes its own counter.

The Labels type must be a named struct, where each field corresponds to a single label. Each field must be of type string.

func (*CounterGroup[L, V]) With

func (*CounterGroup[L, V]) With(labels L) (_ *Counter[V])

type Gauge

type Gauge[V Value] struct {
	// contains filtered or unexported fields
}

func NewGauge

func NewGauge[V Value](name string, cfg GaugeConfig) (_ *Gauge[V])

NewGauge creates a new counter metric, without any labels. Use NewGaugeGroup for metrics with labels.

func (*Gauge[V]) Add

func (*Gauge[V]) Add(val V)

func (*Gauge[V]) Set

func (*Gauge[V]) Set(val V)

type GaugeConfig

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

GaugeConfig configures a gauge. It's currently a placeholder as there is not yet any additional configuration.

type GaugeGroup

type GaugeGroup[L Labels, V Value] struct {
	// contains filtered or unexported fields
}

func NewGaugeGroup

func NewGaugeGroup[L Labels, V Value](name string, cfg GaugeConfig) (_ *GaugeGroup[L, V])

NewGaugeGroup creates a new gauge group with a set of labels, where each unique combination of labels becomes its own gauge.

The Labels type must be a named struct, where each field corresponds to a single label. Each field must be of type string.

func (*GaugeGroup[L, V]) With

func (*GaugeGroup[L, V]) With(labels L) (_ *Gauge[V])

type Labels

type Labels interface {
	comparable
}

type Value

type Value interface {
	uint64 | int64 | float64
}

Jump to

Keyboard shortcuts

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