Help us shape the future of Go! Take the 2026 Go Developer Survey

metric

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CounterInc = "inc"
	CounterAdd = "add"

	ErrCounterActionRequired = "counter action must be defined as either `inc` or `add`"
	ErrCounterInvalidAction  = "action %s is not valid, action must be either `inc` or `add`"
)
View Source
const (
	GaugeSet = "set"
	GaugeInc = "inc"
	GaugeDec = "dec"
	GaugeAdd = "add"
	GaugeSub = "sub"

	ErrGaugeActionRequired = "gauge action must be defined as `set`, `inc`, `dec`, `add`, or `sub`"
	ErrGaugeInvalidAction  = "action %s is not valid, action must be `set`, `inc`, `dec`, `add`, or `sub`"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterConfig

type CounterConfig struct {
	Value  *string `mapstructure:"value"`
	Action string  `mapstructure:"action"`
}

type Counters

type Counters struct {
	Cfg *CounterConfig
	// contains filtered or unexported fields
}

Counters is a vec tor of counters for a each log stream.

func NewCounters

func NewCounters(name, help string, config interface{}) (*Counters, error)

NewCounters creates a new counter vec.

func (Counters) Collect

func (c Counters) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (Counters) Describe

func (c Counters) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector and doesn't declare any metrics on purpose to bypass prometheus validation. see https://godoc.org/github.com/prometheus/client_golang/prometheus#hdr-Custom_Collectors_and_constant_Metrics search for "unchecked"

func (*Counters) With

func (c *Counters) With(labels model.LabelSet) prometheus.Counter

With returns the counter associated with a stream labelset.

type GaugeConfig

type GaugeConfig struct {
	Value  *string `mapstructure:"value"`
	Action string  `mapstructure:"action"`
}

type Gauges

type Gauges struct {
	Cfg *GaugeConfig
	// contains filtered or unexported fields
}

Gauges is a vector of gauges for a each log stream.

func NewGauges

func NewGauges(name, help string, config interface{}) (*Gauges, error)

NewGauges creates a new gauge vec.

func (Gauges) Collect

func (c Gauges) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (Gauges) Describe

func (c Gauges) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector and doesn't declare any metrics on purpose to bypass prometheus validation. see https://godoc.org/github.com/prometheus/client_golang/prometheus#hdr-Custom_Collectors_and_constant_Metrics search for "unchecked"

func (*Gauges) With

func (g *Gauges) With(labels model.LabelSet) prometheus.Gauge

With returns the gauge associated with a stream labelset.

type HistogramConfig

type HistogramConfig struct {
	Value   *string   `mapstructure:"value"`
	Buckets []float64 `mapstructure:"buckets"`
}

type Histograms

type Histograms struct {
	Cfg *HistogramConfig
	// contains filtered or unexported fields
}

Histograms is a vector of histograms for a each log stream.

func NewHistograms

func NewHistograms(name, help string, config interface{}) (*Histograms, error)

NewHistograms creates a new histogram vec.

func (Histograms) Collect

func (c Histograms) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (Histograms) Describe

func (c Histograms) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector and doesn't declare any metrics on purpose to bypass prometheus validation. see https://godoc.org/github.com/prometheus/client_golang/prometheus#hdr-Custom_Collectors_and_constant_Metrics search for "unchecked"

func (*Histograms) With

func (h *Histograms) With(labels model.LabelSet) prometheus.Histogram

With returns the histogram associated with a stream labelset.

Jump to

Keyboard shortcuts

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