metrics

package
v2.0.0-beta1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 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(dynConf dynamic.Configurations, 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 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 PrometheusHandler

type PrometheusHandler struct{}

PrometheusHandler exposes Prometheus routes.

func (PrometheusHandler) Append

func (h PrometheusHandler) Append(router *mux.Router)

Append adds Prometheus routes on a router.

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
	EntryPointReqDurationHistogram() metrics.Histogram
	EntryPointOpenConnsGauge() metrics.Gauge

	// service metrics
	ServiceReqsCounter() metrics.Counter
	ServiceReqDurationHistogram() metrics.Histogram
	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.

Jump to

Keyboard shortcuts

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