metrics

package
v0.0.0-...-6e5121b Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureOutputs

func ConfigureOutputs(cfg *Config) (err error)

ConfigureOutputs will take the specified config and enable the required outputs.

func Exp

func Exp()

Exp will enable the metrics to be exported

func GetOrRegister

func GetOrRegister(name string, i interface{}) interface{}

func GetOrRegisterCounter

func GetOrRegisterCounter(name string) gom.Counter

func GetOrRegisterGauge

func GetOrRegisterGauge(name string) gom.Gauge

func GetOrRegisterHistogram

func GetOrRegisterHistogram(name string, sample gom.Sample) gom.Histogram

func GetOrRegisterMeter

func GetOrRegisterMeter(name string) gom.Meter

func GetOrRegisterTimer

func GetOrRegisterTimer(name string) gom.Timer

func NewFileOutput

func NewFileOutput(cfg *Config) (err error)

NewFileOutput configures a log to periodically write metrics to.

func NewHTTPServer

func NewHTTPServer(cfg *Config) (err error)

NewHTTPServer sets up an HTTP server to export metrics to (if enabled) Metrics will be hosted at http://localhost:<port>/debug/metrics, where <port> is the configured port number.

func Register

func Register(name string, i interface{}) error

func Unregister

func Unregister(name string)

func UnregisterAll

func UnregisterAll()

Types

type Config

type Config struct {
	Enabled    bool        `yaml:"enabled"`
	Runtime    bool        `yaml:"runtime"`
	FileOutput *out.Config `yaml:"file"`
	HTTPOutput *HTTPConfig `yaml:"http"`
}

Config defines output settings for metrics

func ConfigFromMap

func ConfigFromMap(config map[string]interface{}) *Config

ConfigFromMap returns a Config based on map values. Used with spf13/viper.

type HTTPConfig

type HTTPConfig struct {
	Enabled bool `yaml:"enabled"`
	Port    int  `yaml:"port"`
}

HTTPConfig defines the HTTP server to host metrics data on

type Registry

type Registry gom.Registry

Registry is a metrics registry

Jump to

Keyboard shortcuts

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