metrics

package
v2.2.11 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetricNamePrefix prefix of all metric names
	MetricNamePrefix = "traefik_"

	// MetricServicePrefix prefix of all service metric names
	MetricServicePrefix = MetricNamePrefix + "service_"
)

Variables

This section is empty.

Functions

func OnConfigurationUpdate

func OnConfigurationUpdate(conf dynamic.Configuration, entryPoints []string)

OnConfigurationUpdate receives the current configuration from Traefik. It then converts the configuration to the optimized package internal format and sets it to the promState.

func PrometheusHandler

func PrometheusHandler() http.Handler

PrometheusHandler exposes Prometheus routes.

func StopDatadog

func StopDatadog()

StopDatadog stops internal datadogTicker which controls the pushing of metrics to DD Agent and resets it to `nil`.

func StopInfluxDB

func StopInfluxDB()

StopInfluxDB stops internal influxDBTicker which controls the pushing of metrics to InfluxDB Agent and resets it to `nil`.

func StopStatsd

func StopStatsd()

StopStatsd stops internal statsdTicker which controls the pushing of metrics to StatsD Agent and resets it to `nil`.

Types

type HistogramWithScale added in v2.1.7

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

HistogramWithScale is a histogram that will convert its observed value to the specified unit.

func (*HistogramWithScale) Observe added in v2.1.7

func (s *HistogramWithScale) Observe(v float64)

Observe implements ScalableHistogram.

func (*HistogramWithScale) ObserveFromStart added in v2.1.8

func (s *HistogramWithScale) ObserveFromStart(start time.Time)

ObserveFromStart implements ScalableHistogram.

func (*HistogramWithScale) With added in v2.1.7

func (s *HistogramWithScale) With(labelValues ...string) ScalableHistogram

With implements ScalableHistogram.

type MultiHistogram added in v2.1.7

type MultiHistogram []ScalableHistogram

MultiHistogram collects multiple individual histograms and treats them as a unit.

func NewMultiHistogram added in v2.1.7

func NewMultiHistogram(h ...ScalableHistogram) MultiHistogram

NewMultiHistogram returns a multi-histogram, wrapping the passed histograms.

func (MultiHistogram) Observe added in v2.1.7

func (h MultiHistogram) Observe(v float64)

Observe implements ScalableHistogram.

func (MultiHistogram) ObserveFromStart added in v2.1.8

func (h MultiHistogram) ObserveFromStart(start time.Time)

ObserveFromStart implements ScalableHistogram.

func (MultiHistogram) With added in v2.1.7

func (h MultiHistogram) With(labelValues ...string) ScalableHistogram

With implements ScalableHistogram.

type Registry

type Registry interface {
	// IsEpEnabled shows whether metrics instrumentation is enabled on entry points.
	IsEpEnabled() bool
	// IsSvcEnabled shows whether metrics instrumentation is enabled on services.
	IsSvcEnabled() bool

	// server metrics
	ConfigReloadsCounter() metrics.Counter
	ConfigReloadsFailureCounter() metrics.Counter
	LastConfigReloadSuccessGauge() metrics.Gauge
	LastConfigReloadFailureGauge() metrics.Gauge

	// entry point metrics
	EntryPointReqsCounter() metrics.Counter
	EntryPointReqsTLSCounter() metrics.Counter
	EntryPointReqDurationHistogram() ScalableHistogram
	EntryPointOpenConnsGauge() metrics.Gauge

	// service metrics
	ServiceReqsCounter() metrics.Counter
	ServiceReqsTLSCounter() metrics.Counter
	ServiceReqDurationHistogram() ScalableHistogram
	ServiceOpenConnsGauge() metrics.Gauge
	ServiceRetriesCounter() metrics.Counter
	ServiceServerUpGauge() metrics.Gauge
}

Registry has to implemented by any system that wants to monitor and expose metrics.

func NewMultiRegistry

func NewMultiRegistry(registries []Registry) Registry

NewMultiRegistry is an implementation of metrics.Registry that wraps multiple registries. It handles the case when a registry hasn't registered some metric and returns nil. This allows for feature imparity between the different metric implementations.

func NewVoidRegistry

func NewVoidRegistry() Registry

NewVoidRegistry is a noop implementation of metrics.Registry. It is used to avoid nil checking in components that do metric collections.

func RegisterDatadog

func RegisterDatadog(ctx context.Context, config *types.Datadog) Registry

RegisterDatadog registers the metrics pusher if this didn't happen yet and creates a datadog Registry instance.

func RegisterInfluxDB

func RegisterInfluxDB(ctx context.Context, config *types.InfluxDB) Registry

RegisterInfluxDB registers the metrics pusher if this didn't happen yet and creates a InfluxDB Registry instance.

func RegisterPrometheus

func RegisterPrometheus(ctx context.Context, config *types.Prometheus) Registry

RegisterPrometheus registers all Prometheus metrics. It must be called only once and failing to register the metrics will lead to a panic.

func RegisterStatsd

func RegisterStatsd(ctx context.Context, config *types.Statsd) Registry

RegisterStatsd registers the metrics pusher if this didn't happen yet and creates a statsd Registry instance.

type ScalableHistogram added in v2.1.7

type ScalableHistogram interface {
	With(labelValues ...string) ScalableHistogram
	Observe(v float64)
	ObserveFromStart(start time.Time)
}

ScalableHistogram is a Histogram with a predefined time unit, used when producing observations without explicitly setting the observed value.

func NewHistogramWithScale added in v2.1.7

func NewHistogramWithScale(histogram metrics.Histogram, unit time.Duration) (ScalableHistogram, error)

NewHistogramWithScale returns a ScalableHistogram. It returns an error if the given unit is <= 0.

Jump to

Keyboard shortcuts

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