Documentation ¶
Index ¶
- Constants
- func OnConfigurationUpdate(conf dynamic.Configuration, entryPoints []string)
- func PrometheusHandler() http.Handler
- func SetMeterProvider(meterProvider *sdkmetric.MeterProvider)
- func StopDatadog()
- func StopInfluxDB2()
- func StopOpenTelemetry()
- func StopStatsd()
- type CounterWithHeaders
- type CounterWithNoopHeaders
- type HistogramWithScale
- type MultiCounterWithHeaders
- type MultiHistogram
- type Registry
- func NewMultiRegistry(registries []Registry) Registry
- func NewVoidRegistry() Registry
- func RegisterDatadog(ctx context.Context, config *types.Datadog) Registry
- func RegisterInfluxDB2(ctx context.Context, config *types.InfluxDB2) Registry
- func RegisterOpenTelemetry(ctx context.Context, config *types.OTLP) Registry
- func RegisterPrometheus(ctx context.Context, config *types.Prometheus) Registry
- func RegisterStatsd(ctx context.Context, config *types.Statsd) Registry
- type ScalableHistogram
- type SemConvMetricsRegistry
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 SetMeterProvider ¶
func SetMeterProvider(meterProvider *sdkmetric.MeterProvider)
SetMeterProvider sets the meter provider for the tests.
func StopInfluxDB2 ¶
func StopInfluxDB2()
StopInfluxDB2 stops and resets InfluxDB2 client, ticker and store.
func StopOpenTelemetry ¶
func StopOpenTelemetry()
StopOpenTelemetry stops and resets Open-Telemetry client.
func StopStatsd ¶
func StopStatsd()
StopStatsd stops internal statsdTicker which controls the pushing of metrics to StatsD Agent and resets it to `nil`.
Types ¶
type CounterWithHeaders ¶
type CounterWithHeaders interface { Add(delta float64) With(headers http.Header, labelValues ...string) CounterWithHeaders }
CounterWithHeaders represents a counter that can use http.Header values as label values.
type CounterWithNoopHeaders ¶
type CounterWithNoopHeaders struct {
// contains filtered or unexported fields
}
CounterWithNoopHeaders is a counter that satisfies CounterWithHeaders but ignores the given http.Header.
func NewCounterWithNoopHeaders ¶
func NewCounterWithNoopHeaders(counter metrics.Counter) CounterWithNoopHeaders
NewCounterWithNoopHeaders returns a CounterWithNoopHeaders.
func (CounterWithNoopHeaders) Add ¶
func (c CounterWithNoopHeaders) Add(delta float64)
Add adds the given delta value to the counter value.
func (CounterWithNoopHeaders) With ¶
func (c CounterWithNoopHeaders) With(_ http.Header, labelValues ...string) CounterWithHeaders
With creates a new counter by appending the given label values and returns it.
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 MultiCounterWithHeaders ¶
type MultiCounterWithHeaders []CounterWithHeaders
MultiCounterWithHeaders collects multiple individual CounterWithHeaders and treats them as a unit.
func NewMultiCounterWithHeaders ¶
func NewMultiCounterWithHeaders(c ...CounterWithHeaders) MultiCounterWithHeaders
NewMultiCounterWithHeaders returns a multi-counter, wrapping the passed CounterWithHeaders.
func (MultiCounterWithHeaders) Add ¶
func (c MultiCounterWithHeaders) Add(delta float64)
Add adds the given delta value to the counter value.
func (MultiCounterWithHeaders) With ¶
func (c MultiCounterWithHeaders) With(headers http.Header, labelValues ...string) CounterWithHeaders
With creates a new counter by appending the given label values and http.Header as labels and returns it.
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 LastConfigReloadSuccessGauge() metrics.Gauge OpenConnectionsGauge() metrics.Gauge TLSCertsNotAfterTimestampGauge() metrics.Gauge EntryPointReqsCounter() CounterWithHeaders EntryPointReqsTLSCounter() metrics.Counter EntryPointReqDurationHistogram() ScalableHistogram EntryPointReqsBytesCounter() metrics.Counter EntryPointRespsBytesCounter() metrics.Counter RouterReqsCounter() CounterWithHeaders RouterReqsTLSCounter() metrics.Counter RouterReqDurationHistogram() ScalableHistogram RouterReqsBytesCounter() metrics.Counter RouterRespsBytesCounter() metrics.Counter ServiceReqsCounter() CounterWithHeaders ServiceReqsTLSCounter() metrics.Counter ServiceReqDurationHistogram() ScalableHistogram 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 RegisterInfluxDB2 ¶
RegisterInfluxDB2 creates metrics exporter for InfluxDB2.
func RegisterOpenTelemetry ¶
RegisterOpenTelemetry registers all OpenTelemetry metrics.
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.
type SemConvMetricsRegistry ¶
type SemConvMetricsRegistry struct {
// contains filtered or unexported fields
}
SemConvMetricsRegistry holds stables semantic conventions metric instruments.
func NewSemConvMetricRegistry ¶
func NewSemConvMetricRegistry(ctx context.Context, config *types.OTLP) (*SemConvMetricsRegistry, error)
NewSemConvMetricRegistry registers all stables semantic conventions metrics.
func (*SemConvMetricsRegistry) HTTPClientRequestDuration ¶
func (s *SemConvMetricsRegistry) HTTPClientRequestDuration() metric.Float64Histogram
HTTPClientRequestDuration returns the HTTP client request duration histogram.
func (*SemConvMetricsRegistry) HTTPServerRequestDuration ¶
func (s *SemConvMetricsRegistry) HTTPServerRequestDuration() metric.Float64Histogram
HTTPServerRequestDuration returns the HTTP server request duration histogram.