metrics

package
Version: v0.0.0-...-ef44e86 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: Apache-2.0 Imports: 4 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, error)

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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL