metrics

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(m interface{}, factory Factory) error

func InitD

func InitD(m interface{}) error

func MustInit

func MustInit(metrics interface{}, factory Factory)

func MustInitD

func MustInitD(metrics interface{})

func SetDefaultFactory

func SetDefaultFactory(factory Factory)

Types

type Counter

type Counter interface {
	With(labelValues ...string) Counter
	Inc()
	Add(delta float64)
}

Counter describes a metric that accumulates values monotonically. An example of a counter is the number of received HTTP requests.

var NullCounter Counter = &nullCounter{}

type Factory

type Factory interface {
	Counter(metric Options) Counter
	Gauge(metric Options) Gauge
	Histogram(metric HistogramOptions) Histogram
}

Factory creates new metrics

var DefaultFactory Factory = NullFactory
var NullFactory Factory = &nullFactory{}

type Gauge

type Gauge interface {
	With(labelValues ...string) Gauge
	Set(value float64)
	Add(delta float64)
}

Gauge describes a metric that takes specific values over time. An example of a gauge is the current depth of a job queue.

var NullGauge Gauge = &nullGauge{}

type Histogram

type Histogram interface {
	With(labelValues ...string) Histogram
	Observe(value float64)
}

Histogram describes a metric that takes repeated observations of the same kind of thing, and produces a statistical summary of those observations, typically expressed as quantiles or buckets. An example of a histogram is HTTP request latencies.

var NullSummary Histogram = &nullSummary{}

type HistogramOptions

type HistogramOptions struct {
	Name   string
	Tags   map[string]string
	Labels []string
	Help   string
}

HistogramOptions defines the information associated with a metric

type Options

type Options struct {
	Name   string
	Tags   map[string]string
	Labels []string
	Help   string
}

Options defines the information associated with a metric

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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