metrics.go (traefik-v2.3.2.src) | : | metrics.go (traefik-v2.3.3.src) | ||
---|---|---|---|---|
package types | package types | |||
import ( | import ( | |||
"time" | "time" | |||
"github.com/traefik/paerser/types" | "github.com/traefik/paerser/types" | |||
) | ) | |||
// Metrics provides options to expose and send Traefik metrics to different thir d party monitoring systems. | // Metrics provides options to expose and send Traefik metrics to different thir d party monitoring systems. | |||
type Metrics struct { | type Metrics struct { | |||
Prometheus *Prometheus `description:"Prometheus metrics exporter type." j | Prometheus *Prometheus `description:"Prometheus metrics exporter type." j | |||
son:"prometheus,omitempty" toml:"prometheus,omitempty" yaml:"prometheus,omitempt | son:"prometheus,omitempty" toml:"prometheus,omitempty" yaml:"prometheus,omitempt | |||
y" export:"true" label:"allowEmpty" file:"allowEmpty"` | y" label:"allowEmpty" file:"allowEmpty" export:"true"` | |||
Datadog *Datadog `description:"Datadog metrics exporter type." json | Datadog *Datadog `description:"Datadog metrics exporter type." json | |||
:"datadog,omitempty" toml:"datadog,omitempty" yaml:"datadog,omitempty" export:"t | :"datadog,omitempty" toml:"datadog,omitempty" yaml:"datadog,omitempty" label:"al | |||
rue" label:"allowEmpty" file:"allowEmpty"` | lowEmpty" file:"allowEmpty" export:"true"` | |||
StatsD *Statsd `description:"StatsD metrics exporter type." json: | StatsD *Statsd `description:"StatsD metrics exporter type." json: | |||
"statsD,omitempty" toml:"statsD,omitempty" yaml:"statsD,omitempty" export:"true" | "statsD,omitempty" toml:"statsD,omitempty" yaml:"statsD,omitempty" label:"allowE | |||
label:"allowEmpty" file:"allowEmpty"` | mpty" file:"allowEmpty" export:"true"` | |||
InfluxDB *InfluxDB `description:"InfluxDB metrics exporter type." jso | InfluxDB *InfluxDB `description:"InfluxDB metrics exporter type." jso | |||
n:"influxDB,omitempty" toml:"influxDB,omitempty" yaml:"influxDB,omitempty" label | n:"influxDB,omitempty" toml:"influxDB,omitempty" yaml:"influxDB,omitempty" label | |||
:"allowEmpty" file:"allowEmpty"` | :"allowEmpty" file:"allowEmpty" export:"true"` | |||
} | } | |||
// Prometheus can contain specific configuration used by the Prometheus Metrics exporter. | // Prometheus can contain specific configuration used by the Prometheus Metrics exporter. | |||
type Prometheus struct { | type Prometheus struct { | |||
Buckets []float64 `description:"Buckets for latency metrics. " json:"buckets,omitempty" toml:"buckets,omitempty" yaml:"buckets,omitempty" exp ort:"true"` | Buckets []float64 `description:"Buckets for latency metrics. " json:"buckets,omitempty" toml:"buckets,omitempty" yaml:"buckets,omitempty" exp ort:"true"` | |||
AddEntryPointsLabels bool `description:"Enable metrics on entry poin ts." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"` | AddEntryPointsLabels bool `description:"Enable metrics on entry poin ts." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"` | |||
AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"add ServicesLabels,omitempty" export:"true"` | AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"add ServicesLabels,omitempty" export:"true"` | |||
EntryPoint string `description:"EntryPoint" export:"true" js on:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty "` | EntryPoint string `description:"EntryPoint" export:"true" js on:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty "` | |||
ManualRouting bool `description:"Manual routing" json:"manual Routing,omitempty" toml:"manualRouting,omitempty" yaml:"manualRouting,omitempty" ` | ManualRouting bool `description:"Manual routing" json:"manual Routing,omitempty" toml:"manualRouting,omitempty" yaml:"manualRouting,omitempty" export:"true"` | |||
} | } | |||
// SetDefaults sets the default values. | // SetDefaults sets the default values. | |||
func (p *Prometheus) SetDefaults() { | func (p *Prometheus) SetDefaults() { | |||
p.Buckets = []float64{0.1, 0.3, 1.2, 5} | p.Buckets = []float64{0.1, 0.3, 1.2, 5} | |||
p.AddEntryPointsLabels = true | p.AddEntryPointsLabels = true | |||
p.AddServicesLabels = true | p.AddServicesLabels = true | |||
p.EntryPoint = "traefik" | p.EntryPoint = "traefik" | |||
} | } | |||
skipping to change at line 75 | skipping to change at line 75 | |||
s.Prefix = "traefik" | s.Prefix = "traefik" | |||
} | } | |||
// InfluxDB contains address, login and metrics pushing interval configuration. | // InfluxDB contains address, login and metrics pushing interval configuration. | |||
type InfluxDB struct { | type InfluxDB struct { | |||
Address string `description:"InfluxDB address." json :"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty"` | Address string `description:"InfluxDB address." json :"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty"` | |||
Protocol string `description:"InfluxDB address protoc ol (udp or http)." json:"protocol,omitempty" toml:"protocol,omitempty" yaml:"pro tocol,omitempty"` | Protocol string `description:"InfluxDB address protoc ol (udp or http)." json:"protocol,omitempty" toml:"protocol,omitempty" yaml:"pro tocol,omitempty"` | |||
PushInterval types.Duration `description:"InfluxDB push interval. " json:"pushInterval,omitempty" toml:"pushInterval,omitempty" yaml:"pushInterval ,omitempty" export:"true"` | PushInterval types.Duration `description:"InfluxDB push interval. " json:"pushInterval,omitempty" toml:"pushInterval,omitempty" yaml:"pushInterval ,omitempty" export:"true"` | |||
Database string `description:"InfluxDB database used when protocol is http." json:"database,omitempty" toml:"database,omitempty" yaml :"database,omitempty" export:"true"` | Database string `description:"InfluxDB database used when protocol is http." json:"database,omitempty" toml:"database,omitempty" yaml :"database,omitempty" export:"true"` | |||
RetentionPolicy string `description:"InfluxDB retention poli cy used when protocol is http." json:"retentionPolicy,omitempty" toml:"retention Policy,omitempty" yaml:"retentionPolicy,omitempty" export:"true"` | RetentionPolicy string `description:"InfluxDB retention poli cy used when protocol is http." json:"retentionPolicy,omitempty" toml:"retention Policy,omitempty" yaml:"retentionPolicy,omitempty" export:"true"` | |||
Username string `description:"InfluxDB username (only | Username string `description:"InfluxDB username (only | |||
with http)." json:"username,omitempty" toml:"username,omitempty" yaml:"username | with http)." json:"username,omitempty" toml:"username,omitempty" yaml:"username | |||
,omitempty" export:"true"` | ,omitempty"` | |||
Password string `description:"InfluxDB password (only | Password string `description:"InfluxDB password (only | |||
with http)." json:"password,omitempty" toml:"password,omitempty" yaml:"password | with http)." json:"password,omitempty" toml:"password,omitempty" yaml:"password | |||
,omitempty" export:"true"` | ,omitempty"` | |||
AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omite mpty" yaml:"addEntryPointsLabels,omitempty" export:"true"` | AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omite mpty" yaml:"addEntryPointsLabels,omitempty" export:"true"` | |||
AddServicesLabels bool `description:"Enable metrics on servi ces." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml :"addServicesLabels,omitempty" export:"true"` | AddServicesLabels bool `description:"Enable metrics on servi ces." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml :"addServicesLabels,omitempty" export:"true"` | |||
} | } | |||
// SetDefaults sets the default values. | // SetDefaults sets the default values. | |||
func (i *InfluxDB) SetDefaults() { | func (i *InfluxDB) SetDefaults() { | |||
i.Address = "localhost:8089" | i.Address = "localhost:8089" | |||
i.Protocol = "udp" | i.Protocol = "udp" | |||
i.PushInterval = types.Duration(10 * time.Second) | i.PushInterval = types.Duration(10 * time.Second) | |||
i.AddEntryPointsLabels = true | i.AddEntryPointsLabels = true | |||
End of changes. 3 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added |