metrics

package
v0.0.0-...-d88ec87 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(s string) string

Clean replaces metrics path compound special chars with underscore

func Clear

func Clear()

Clear removes all metrics in Registry

func Init

func Init(cfg Config) (err error)

Init setups metrics publication

func Mark

func Mark(name string)

Mark creates and increments Meter

func Time

func Time(name string, function func())

Time creates and update Timer

func UpdateGauge

func UpdateGauge(name string, value int64)

UpdateGauge changes Gauge value

func UpdateSince

func UpdateSince(name string, since time.Time)

UpdateSince creates and update Timer

Types

type Config

type Config struct {
	// Target, possible values: "graphite", "expvar", "stdout"
	Target string `yaml:"Target,omitempty"`
	// Interval determines how often metrics should be released, applicable for "graphite", "prometheus" and "stdout"
	Interval Interval `yaml:"Interval,omitempty"`
	// Addr points graphite collector address
	Addr string `yaml:"Addr,omitempty"`
	// ExpAddr is expvar server adress
	ExpAddr string `yaml:"ExpAddr,omitempty"`
	// Prefix graphite metrics
	Prefix string `yaml:"Prefix,omitempty"`
	// Percentiles customizes metrics sent to graphite default: 0.75, 0.95, 0.99, 0.999
	Percentiles []float64 `yaml:"Percentiles"`
	// Debug includes runtime.MemStats metrics
	Debug bool `yaml:"Debug"`
	// AppendDefaults adds "<hostname>.<process>"  suffix
	AppendDefaults bool `yaml:"AppendDefaults,omitempty"`
}

Config defines metrics publication details

type Interval

type Interval struct {
	time.Duration
}

Interval is time.Duration wrapper

func (*Interval) UnmarshalYAML

func (interval *Interval) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements

Jump to

Keyboard shortcuts

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