metrics

package
v0.0.0-...-88351dd Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// if empty, will server default to "expvar"
	Type Type `envconfig:"METRICS_TYPE"`

	// Prefix will be prefixed onto
	// any metric name.
	Prefix string `envconfig:"METRICS_PREFIX"`

	// Namespace is used by prometheus.
	Namespace string `envconfig:"METRICS_NAMESPACE"`
	// Subsystem is used by prometheus.
	Subsystem string `envconfig:"METRICS_SUBSYSTEM"`

	// Used by statsd, graphite and dogstatsd
	Interval time.Duration `envconfig:"METRICS_INTERVAL"`

	// Used by statsd, graphite and dogstatsd.
	Addr string `envconfig:"METRICS_ADDR"`
	// Used by statsd, graphite and dogstatsd to dial a connection.
	// If empty, will default to "udp".
	Network string `envconfig:"METRICS_NETWORK"`

	// Used by expvar only.
	// if empty, will default to "/debug/vars"
	Path string `envconfig:"METRICS_PATH"`

	// Used by graphite only.
	// If none provided, kit/log/NewNopLogger will be used.
	Logger log.Logger
}

Config can be used to configure and instantiate a new go-kit/kit/metrics/provider.Provider.

func LoadConfigFromEnv

func LoadConfigFromEnv() Config

LoadConfigFromEnv will attempt to load a Metrics object from environment variables.

func (Config) NewProvider

func (cfg Config) NewProvider() provider.Provider

NewProvider will use the values in the Metrics config object to generate a new go-kit/metrics/provider.Provider implementation. If no type is given, a no-op implementation will be used.

type Type

type Type string

Type acts as an 'enum' type to represent the available metrics providers

const (
	// Statsd is used by config to indicate use of the statsdProvider.
	Statsd Type = "statsd"
	// DogStatsd is used by config to indicate use of the dogstatsdProvider.
	DogStatsd Type = "dogstatsd"
	// Prometheus is used by config to indicate use of the prometheusProvider.
	Prometheus Type = "prometheus"
	// Graphite is used by config to indicate use of the graphiteProvider.
	Graphite Type = "graphite"
	// Expvar is used by config to indicate use of the expvarProvider.
	Expvar Type = "expvar"
	// Discard is used by config to indicate use of the discardProvider.
	Discard Type = "discard"
)

Jump to

Keyboard shortcuts

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