Documentation ¶
Index ¶
- Constants
- func OnConfigurationUpdate(conf dynamic.Configuration, entryPoints []string)
- func PrometheusHandler() http.Handler
- func StopDatadog()
- func StopInfluxDB()
- func StopInfluxDB2()
- func StopStatsd()
- type HistogramWithScale
- type MultiHistogram
- type Registry
- func NewMultiRegistry(registries []Registry) Registry
- func NewVoidRegistry() Registry
- func RegisterDatadog(ctx context.Context, config *types.Datadog) Registry
- func RegisterInfluxDB(ctx context.Context, config *types.InfluxDB) Registry
- func RegisterInfluxDB2(ctx context.Context, config *types.InfluxDB2) Registry
- func RegisterPrometheus(ctx context.Context, config *types.Prometheus) Registry
- func RegisterStatsd(ctx context.Context, config *types.Statsd) Registry
- type ScalableHistogram
Constants ¶
const (
// MetricNamePrefix prefix of all metric names.
MetricNamePrefix = "traefik_"
)
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 ¶
PrometheusHandler exposes Prometheus routes.
func StopInfluxDB ¶
func StopInfluxDB()
StopInfluxDB stops internal influxDBTicker which controls the pushing of metrics to InfluxDB Agent and resets it to `nil`.
func StopInfluxDB2 ¶ added in v2.7.0
func StopInfluxDB2()
StopInfluxDB2 stops and resets InfluxDB2 client, ticker and store.
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 ¶
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 ¶
func (s *HistogramWithScale) Observe(v float64)
Observe implements ScalableHistogram.
func (*HistogramWithScale) ObserveFromStart ¶
func (s *HistogramWithScale) ObserveFromStart(start time.Time)
ObserveFromStart implements ScalableHistogram.
func (*HistogramWithScale) With ¶
func (s *HistogramWithScale) With(labelValues ...string) ScalableHistogram
With implements ScalableHistogram.
type MultiHistogram ¶
type MultiHistogram []ScalableHistogram
MultiHistogram collects multiple individual histograms and treats them as a unit.
func (MultiHistogram) Observe ¶
func (h MultiHistogram) Observe(v float64)
Observe implements ScalableHistogram.
func (MultiHistogram) ObserveFromStart ¶
func (h MultiHistogram) ObserveFromStart(start time.Time)
ObserveFromStart implements ScalableHistogram.
func (MultiHistogram) With ¶
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 // IsRouterEnabled shows whether metrics instrumentation is enabled on routers. IsRouterEnabled() bool // IsSvcEnabled shows whether metrics instrumentation is enabled on services. IsSvcEnabled() bool ConfigReloadsCounter() metrics.Counter ConfigReloadsFailureCounter() metrics.Counter LastConfigReloadSuccessGauge() metrics.Gauge LastConfigReloadFailureGauge() metrics.Gauge TLSCertsNotAfterTimestampGauge() metrics.Gauge EntryPointReqsCounter() metrics.Counter EntryPointReqsTLSCounter() metrics.Counter EntryPointReqDurationHistogram() ScalableHistogram EntryPointOpenConnsGauge() metrics.Gauge EntryPointReqsBytesCounter() metrics.Counter EntryPointRespsBytesCounter() metrics.Counter RouterReqsCounter() metrics.Counter RouterReqsTLSCounter() metrics.Counter RouterReqDurationHistogram() ScalableHistogram RouterOpenConnsGauge() metrics.Gauge RouterReqsBytesCounter() metrics.Counter RouterRespsBytesCounter() metrics.Counter ServiceReqsCounter() metrics.Counter ServiceReqsTLSCounter() metrics.Counter ServiceReqDurationHistogram() ScalableHistogram ServiceOpenConnsGauge() metrics.Gauge ServiceRetriesCounter() metrics.Counter ServiceServerUpGauge() metrics.Gauge ServiceReqsBytesCounter() metrics.Counter ServiceRespsBytesCounter() metrics.Counter }
Registry has to implemented by any system that wants to monitor and expose metrics.
func NewMultiRegistry ¶
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 disparity 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 ¶
RegisterDatadog registers the metrics pusher if this didn't happen yet and creates a datadog Registry instance.
func RegisterInfluxDB ¶
RegisterInfluxDB registers the metrics pusher if this didn't happen yet and creates a InfluxDB Registry instance.
func RegisterInfluxDB2 ¶ added in v2.7.0
RegisterInfluxDB2 creates metrics exporter for InfluxDB2.
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.
type ScalableHistogram ¶
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 ¶
func NewHistogramWithScale(histogram metrics.Histogram, unit time.Duration) (ScalableHistogram, error)
NewHistogramWithScale returns a ScalableHistogram. It returns an error if the given unit is <= 0.