metric

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartPusher

func StartPusher(ctx context.Context, pushGateway string, jobName string, group map[string]string, interval time.Duration)

Types

type Counter

type Counter interface {
	Inc()
	Add(v float64)
	Close() bool
	Value() float64
}

func NewCounter

func NewCounter(opts CounterOpts) Counter

type CounterOpts

type CounterOpts Opts

type CounterVec

type CounterVec interface {
	// Inc increments labels.
	Inc(labels ...string)
	// Add adds labels with v.
	Add(v float64, labels ...string)

	Close() bool
}

CounterVec interface represents a counter vector.

func NewCounterVec

func NewCounterVec(cfg CounterVecOpts) CounterVec

NewCounterVec returns a CounterVec.

type CounterVecOpts

type CounterVecOpts VectorOpts

A CounterVecOpts is an alias of VectorOpts.

type Gauge

type Gauge interface {
	Set(v float64)
	Inc()
	Add(v float64)
	Close() bool
}

func NewGauge

func NewGauge(o GaugeOpts) Gauge

type GaugeOpts

type GaugeOpts Opts

type GaugeVec

type GaugeVec interface {
	// Set sets v to labels.
	Set(v float64, labels ...string)
	// Inc increments labels.
	Inc(labels ...string)
	// Add adds v to labels.
	Add(v float64, labels ...string)
	Close() bool
}

GaugeVec represents a gauge vector.

func NewGaugeVec

func NewGaugeVec(cfg GaugeVecOpts) GaugeVec

NewGaugeVec returns a GaugeVec.

type GaugeVecOpts

type GaugeVecOpts VectorOpts

GaugeVecOpts is an alias of VectorOpts.

type HistogramVec

type HistogramVec interface {
	// Observe adds observation v to labels.
	Observe(v int64, labels ...string)
	Close() bool
}

A HistogramVec interface represents a histogram vector.

func NewHistogramVec

func NewHistogramVec(cfg HistogramVecOpts) HistogramVec

NewHistogramVec returns a HistogramVec.

type HistogramVecOpts

type HistogramVecOpts struct {
	Namespace string
	Subsystem string
	Name      string
	Help      string
	Labels    []string
	Buckets   []float64
}

A HistogramVecOpts is a histogram vector options.

type Labels

type Labels prom.Labels

type Opts

type Opts struct {
	Namespace   string
	Subsystem   string
	Name        string
	Help        string
	ConstLabels Labels
}

type Timer

type Timer interface {
	Timer() func(labels ...string)

	Observe(duration time.Duration, labels ...string)

	Close()
}

func NewTimer

func NewTimer(cfg VectorOpts, opts ...TimerOption) Timer

NewTimer

type TimerOption

type TimerOption func(*timerOptions)

func WithHistogram

func WithHistogram(need bool) TimerOption

histogram metric

func WithHistogramBuckets

func WithHistogramBuckets(buckets []float64) TimerOption

WithHistogramBuckets set buckets of histogram default value is float64{.00001, .00005, .0001, .0002, .0005, .001, .005, .01, .025, .05, .1, .5, 1, 2.5, 5, 10, 60}

func WithSummary

func WithSummary(need bool) TimerOption

summary metric

func WithSummaryQuantiles

func WithSummaryQuantiles(quantiles map[float64]float64) TimerOption

WithSummaryQuantiles set quantile values default value is {0.5: 0.05, 0.9: 0.01, 0.99: 0.001}

type VectorOpts

type VectorOpts struct {
	Namespace string
	Subsystem string
	Name      string
	Help      string
	Labels    []string
}

Jump to

Keyboard shortcuts

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