package provider

import "github.com/go-kit/kit/metrics/provider"

Index

Types

type Provider

type Provider interface {
	NewCounter(name, help string) metrics.Counter
	NewHistogram(name, help string, min, max int64, sigfigs int, quantiles ...int) (metrics.Histogram, error)
	NewGauge(name, help string) metrics.Gauge
	Stop()
}

Provider represents a union set of constructors and lifecycle management functions for each supported metrics backend. It should be used by those who need to easily swap out implementations, e.g. dynamically, or at a single point in an intermediating framework.

func NewDiscardProvider

func NewDiscardProvider() Provider

NewDiscardProvider returns a provider that will discard all metrics.

func NewDogStatsdProvider

func NewDogStatsdProvider(network, address, prefix string, interval time.Duration, logger log.Logger) (Provider, error)

NewDogStatsdProvider will return a Provider implementation that is a simple wrapper around a dogstatsd.Emitter. All metric names will be prefixed with the given value and data will be emitted once every interval or when the buffer has reached its max size. If no network value is given, it will default to "udp".

func NewExpvarProvider

func NewExpvarProvider(prefix string) Provider

NewExpvarProvider is a very thin wrapper over the expvar package. If a prefix is provided, it will prefix all metric names.

func NewGraphiteProvider

func NewGraphiteProvider(network, address, prefix string, interval time.Duration, logger log.Logger) (Provider, error)

NewGraphiteProvider will return a Provider implementation that is a simple wrapper around a graphite.Emitter. All metric names will be prefixed with the given value and data will be emitted once every interval. If no network value is given, it will default to "udp".

func NewPrometheusProvider

func NewPrometheusProvider(namespace, subsystem string) Provider

NewPrometheusProvider returns a Prometheus provider that uses the provided namespace and subsystem for all metrics.

func NewStatsdProvider

func NewStatsdProvider(network, address, prefix string, interval time.Duration, logger log.Logger) (Provider, error)

NewStatsdProvider will return a Provider implementation that is a simple wrapper around a statsd.Emitter. All metric names will be prefixed with the given value and data will be emitted once every interval or when the buffer has reached its max size. If no network value is given, it will default to "udp".

Source Files

providers.go

Version
v0.2.0
Published
Jul 27, 2016
Platform
windows/amd64
Imports
11 packages
Last checked
2 minutes ago

Tools for package owners.