metrics

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 25 Imported by: 61

Documentation

Index

Constants

View Source
const DefaultNames = "{{clean .Service}}.{{clean .Host}}.{{clean .Path}}.{{clean .TargetURL.Host}}"

DefaultNames contains the default template for route metric names for backends that don't support tags.

View Source
const DefaultPrefix = "{{clean .Hostname}}.{{clean .Exec}}"

DefaulPrefix contains the default template for metrics prefix.

View Source
const DotSeparator = "."
View Source
const PipeSeparator = "|"
View Source
const RoutePrefix = "route"

Variables

This section is empty.

Functions

func Flatten added in v1.6.0

func Flatten(name string, labels []string, separator string) string

func Labels added in v1.6.0

func Labels(labels, values []string, stringsprefix, fieldsep, recsep string) string

func TargetName

func TargetName(service, host, path, target string) (string, error)

TargetName returns the metrics name from the given parameters.

func TargetNameWith added in v1.6.0

func TargetNameWith(name string, values []string) (string, error)

TargetNameWith - this is used for flat metrics backends (no tags support) in With() methods on target metrics.

Types

type CirconusProvider added in v1.6.0

type CirconusProvider struct {
	// contains filtered or unexported fields
}

func NewCirconusProvider added in v1.6.0

func NewCirconusProvider(prefix string, circ config.Circonus, interval time.Duration) (*CirconusProvider, error)

func (*CirconusProvider) NewCounter added in v1.6.0

func (cp *CirconusProvider) NewCounter(name string, labels ...string) gkm.Counter

func (*CirconusProvider) NewGauge added in v1.6.0

func (cp *CirconusProvider) NewGauge(name string, labels ...string) gkm.Gauge

func (*CirconusProvider) NewHistogram added in v1.6.0

func (cp *CirconusProvider) NewHistogram(name string, labels ...string) gkm.Histogram

type DiscardProvider added in v1.6.0

type DiscardProvider struct{}

func (DiscardProvider) NewCounter added in v1.6.0

func (dp DiscardProvider) NewCounter(name string, labels ...string) gkm.Counter

func (DiscardProvider) NewGauge added in v1.6.0

func (dp DiscardProvider) NewGauge(name string, labels ...string) gkm.Gauge

func (DiscardProvider) NewHistogram added in v1.6.0

func (dp DiscardProvider) NewHistogram(name string, labels ...string) gkm.Histogram

type DogstatsdProvider added in v1.6.0

type DogstatsdProvider struct {
	D *dogstatsd.Dogstatsd
}

func NewDogstatsdProvider added in v1.6.0

func NewDogstatsdProvider(prefix, addr string, interval time.Duration) (*DogstatsdProvider, error)

func (*DogstatsdProvider) NewCounter added in v1.6.0

func (dp *DogstatsdProvider) NewCounter(name string, labels ...string) gkm.Counter

func (*DogstatsdProvider) NewGauge added in v1.6.0

func (dp *DogstatsdProvider) NewGauge(name string, labels ...string) gkm.Gauge

func (*DogstatsdProvider) NewHistogram added in v1.6.0

func (dp *DogstatsdProvider) NewHistogram(name string, labels ...string) gkm.Histogram

type GraphiteProvider added in v1.6.0

type GraphiteProvider struct {
	G *graphite.Graphite
	// contains filtered or unexported fields
}

func NewGraphiteProvider added in v1.6.0

func NewGraphiteProvider(prefix, addr string, buckets int, interval time.Duration) (*GraphiteProvider, error)

func (*GraphiteProvider) NewCounter added in v1.6.0

func (g *GraphiteProvider) NewCounter(name string, labels ...string) gkm.Counter

func (*GraphiteProvider) NewGauge added in v1.6.0

func (g *GraphiteProvider) NewGauge(name string, labels ...string) gkm.Gauge

func (*GraphiteProvider) NewHistogram added in v1.6.0

func (g *GraphiteProvider) NewHistogram(name string, labels ...string) gkm.Histogram

type MultiCounter added in v1.6.0

type MultiCounter struct {
	// contains filtered or unexported fields
}

MultiCounter wraps zero or more counters.

func (*MultiCounter) Add added in v1.6.0

func (mc *MultiCounter) Add(v float64)

func (*MultiCounter) With added in v1.6.0

func (mc *MultiCounter) With(labels ...string) gkm.Counter

type MultiGauge added in v1.6.0

type MultiGauge struct {
	// contains filtered or unexported fields
}

MultiGauge wraps zero or more gauges.

func (*MultiGauge) Add added in v1.6.0

func (m *MultiGauge) Add(val float64)

func (*MultiGauge) Set added in v1.6.0

func (m *MultiGauge) Set(n float64)

func (*MultiGauge) With added in v1.6.0

func (m *MultiGauge) With(labels ...string) gkm.Gauge

type MultiHistogram added in v1.6.0

type MultiHistogram struct {
	// contains filtered or unexported fields
}

func (*MultiHistogram) Observe added in v1.6.0

func (m *MultiHistogram) Observe(value float64)

func (*MultiHistogram) With added in v1.6.0

func (m *MultiHistogram) With(labelValues ...string) gkm.Histogram

type MultiProvider added in v1.6.0

type MultiProvider struct {
	// contains filtered or unexported fields
}

MultiProvider wraps zero or more providers.

func NewMultiProvider added in v1.6.0

func NewMultiProvider(p []Provider) *MultiProvider

func (*MultiProvider) NewCounter added in v1.6.0

func (mp *MultiProvider) NewCounter(name string, labels ...string) gkm.Counter

NewCounter creates a MultiCounter with counter objects for all registered providers.

func (*MultiProvider) NewGauge added in v1.6.0

func (mp *MultiProvider) NewGauge(name string, labels ...string) gkm.Gauge

NewGauge creates a MultiGauge with gauge objects for all registered providers.

func (*MultiProvider) NewHistogram added in v1.6.0

func (mp *MultiProvider) NewHistogram(name string, labels ...string) gkm.Histogram

type PromProvider added in v1.6.0

type PromProvider struct {
	Opts    promclient.Opts
	Buckets []float64
}

func (*PromProvider) NewCounter added in v1.6.0

func (p *PromProvider) NewCounter(name string, labels ...string) gkm.Counter

func (*PromProvider) NewGauge added in v1.6.0

func (p *PromProvider) NewGauge(name string, labels ...string) gkm.Gauge

func (*PromProvider) NewHistogram added in v1.6.0

func (p *PromProvider) NewHistogram(name string, labels ...string) gkm.Histogram

type Provider added in v1.6.0

type Provider interface {
	// NewCounter creates a new counter object.
	NewCounter(name string, labels ...string) gkm.Counter

	// NewGauge creates a new gauge object.
	NewGauge(name string, labels ...string) gkm.Gauge

	// NewHistogram creates a new histogram object
	NewHistogram(name string, labels ...string) gkm.Histogram
}

Provider is an abstraction of a metrics backend.

func Initialize added in v1.6.0

func Initialize(cfg *config.Metrics) (Provider, error)

func NewPromProvider added in v1.6.0

func NewPromProvider(namespace, subsystem string, buckets []float64) Provider

type Service added in v1.6.0

type Service struct {
	Service   string
	Host      string
	Path      string
	TargetURL *url.URL
}

func (Service) String added in v1.6.0

func (s Service) String() string

type StatsdProvider added in v1.6.0

type StatsdProvider struct {
	S *statsd.Statsd
}

func NewStatsdProvider added in v1.6.0

func NewStatsdProvider(prefix, addr string, interval time.Duration) (*StatsdProvider, error)

func (*StatsdProvider) NewCounter added in v1.6.0

func (p *StatsdProvider) NewCounter(name string, labels ...string) gkm.Counter

NewCounter - This assumes if there are labels, there will be a With() call

func (*StatsdProvider) NewGauge added in v1.6.0

func (p *StatsdProvider) NewGauge(name string, labels ...string) gkm.Gauge

NewGauge - this assumes if there are labels, there will be a With() call.

func (*StatsdProvider) NewHistogram added in v1.6.0

func (p *StatsdProvider) NewHistogram(name string, labels ...string) gkm.Histogram

NewHistogram - this assumes if there are labels, there will be a With() call.

Jump to

Keyboard shortcuts

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