Documentation ¶
Index ¶
- Constants
- func OnConfigurationUpdate(conf dynamic.Configuration, entryPoints []string)
- func PrometheusHandler() http.Handler
- func StopDatadog()
- func StopInfluxDB()
- func StopStatsd()
- type HistogramWithScale
- type MultiHistogram
- type PilotMetric
- type PilotRegistry
- func (r PilotRegistry) ConfigReloadsCounter() metrics.Counter
- func (r PilotRegistry) ConfigReloadsFailureCounter() metrics.Counter
- func (pr *PilotRegistry) Data() []PilotMetric
- func (r PilotRegistry) EntryPointOpenConnsGauge() metrics.Gauge
- func (r PilotRegistry) EntryPointReqDurationHistogram() ScalableHistogram
- func (r PilotRegistry) EntryPointReqsCounter() metrics.Counter
- func (r PilotRegistry) EntryPointReqsTLSCounter() metrics.Counter
- func (r PilotRegistry) IsEpEnabled() bool
- func (r PilotRegistry) IsSvcEnabled() bool
- func (r PilotRegistry) LastConfigReloadFailureGauge() metrics.Gauge
- func (r PilotRegistry) LastConfigReloadSuccessGauge() metrics.Gauge
- func (r PilotRegistry) ServiceOpenConnsGauge() metrics.Gauge
- func (r PilotRegistry) ServiceReqDurationHistogram() ScalableHistogram
- func (r PilotRegistry) ServiceReqsCounter() metrics.Counter
- func (r PilotRegistry) ServiceReqsTLSCounter() metrics.Counter
- func (r PilotRegistry) ServiceRetriesCounter() metrics.Counter
- func (r PilotRegistry) ServiceServerUpGauge() metrics.Gauge
- 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 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_" // 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 ¶
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 ¶
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 NewMultiHistogram ¶
func NewMultiHistogram(h ...ScalableHistogram) MultiHistogram
NewMultiHistogram returns a multi-histogram, wrapping the passed histograms.
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 PilotMetric ¶
type PilotMetric struct { Name string `json:"name"` Type string `json:"type"` Observations map[string]interface{} `json:"observations"` }
PilotMetric is a representation of a metric.
type PilotRegistry ¶
type PilotRegistry struct {
// contains filtered or unexported fields
}
PilotRegistry represents the pilots metrics registry.
func (PilotRegistry) ConfigReloadsCounter ¶
func (PilotRegistry) ConfigReloadsFailureCounter ¶
func (*PilotRegistry) Data ¶
func (pr *PilotRegistry) Data() []PilotMetric
Data exports the metrics: metrics name -> labels -> values.
func (PilotRegistry) EntryPointOpenConnsGauge ¶
func (PilotRegistry) EntryPointReqDurationHistogram ¶
func (r PilotRegistry) EntryPointReqDurationHistogram() ScalableHistogram
func (PilotRegistry) EntryPointReqsCounter ¶
func (PilotRegistry) EntryPointReqsTLSCounter ¶
func (PilotRegistry) IsEpEnabled ¶
func (r PilotRegistry) IsEpEnabled() bool
func (PilotRegistry) IsSvcEnabled ¶
func (r PilotRegistry) IsSvcEnabled() bool
func (PilotRegistry) LastConfigReloadFailureGauge ¶
func (PilotRegistry) LastConfigReloadSuccessGauge ¶
func (PilotRegistry) ServiceOpenConnsGauge ¶
func (PilotRegistry) ServiceReqDurationHistogram ¶
func (r PilotRegistry) ServiceReqDurationHistogram() ScalableHistogram
func (PilotRegistry) ServiceReqsCounter ¶
func (PilotRegistry) ServiceReqsTLSCounter ¶
func (PilotRegistry) ServiceRetriesCounter ¶
func (PilotRegistry) ServiceServerUpGauge ¶
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 ¶
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 ¶
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 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.