provider

package
v0.0.0-...-a11eda2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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".

Jump to

Keyboard shortcuts

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