Skip to content

Commit

Permalink
🚀 Add complete support on metrics options (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
mloiseleur authored Nov 23, 2022
1 parent b9c0252 commit 32e1c4f
Show file tree
Hide file tree
Showing 5 changed files with 598 additions and 25 deletions.
146 changes: 141 additions & 5 deletions traefik/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,156 @@
# Change Log

## 20.5.0 ![AppVersion: v2.9.4](https://img.shields.io/static/v1?label=AppVersion&message=v2.9.4&color=success&logo=) ![Helm: v3](https://img.shields.io/static/v1?label=Helm&message=v3&color=informational&logo=helm)

**Release date:** 2022-11-22

* 🚀 Add complete support on metrics options
* 🐛 make tests use fixed version

### Default value changes

```diff
diff --git a/traefik/values.yaml b/traefik/values.yaml
index e49d02d..15f1682 100644
--- a/traefik/values.yaml
+++ b/traefik/values.yaml
@@ -12,7 +12,7 @@ hub:
## Enabling Hub will:
# * enable Traefik Hub integration on Traefik
# * add `traefikhub-tunl` endpoint
- # * enable addRoutersLabels on prometheus metrics
+ # * enable Prometheus metrics with addRoutersLabels
# * enable allowExternalNameServices on KubernetesIngress provider
# * enable allowCrossNamespace on KubernetesCRD provider
# * add an internal (ClusterIP) Service, dedicated for Traefik Hub
@@ -254,16 +254,96 @@ logs:
# Content-Type: keep

metrics:
- # datadog:
- # address: 127.0.0.1:8125
- # influxdb:
- # address: localhost:8089
- # protocol: udp
+ ## Prometheus is enabled by default.
+ ## It can be disabled by setting "prometheus: null"
prometheus:
+ ## Entry point used to expose metrics.
entryPoint: metrics
- # addRoutersLabels: true
- # statsd:
- # address: localhost:8125
+ ## Enable metrics on entry points. Default=true
+ # addEntryPointsLabels: false
+ ## Enable metrics on routers. Default=false
+ # addRoutersLabels: true
+ ## Enable metrics on services. Default=true
+ # addServicesLabels: false
+ ## Buckets for latency metrics. Default="0.1,0.3,1.2,5.0"
+ # buckets: "0.5,1.0,2.5"
+ ## When manualRouting is true, it disables the default internal router in
+ ## order to allow creating a custom router for prometheus@internal service.
+ # manualRouting: true
+# datadog:
+# ## Address instructs exporter to send metrics to datadog-agent at this address.
+# address: "127.0.0.1:8125"
+# ## The interval used by the exporter to push metrics to datadog-agent. Default=10s
+# # pushInterval: 30s
+# ## The prefix to use for metrics collection. Default="traefik"
+# # prefix: traefik
+# ## Enable metrics on entry points. Default=true
+# # addEntryPointsLabels: false
+# ## Enable metrics on routers. Default=false
+# # addRoutersLabels: true
+# ## Enable metrics on services. Default=true
+# # addServicesLabels: false
+# influxdb:
+# ## Address instructs exporter to send metrics to influxdb at this address.
+# address: localhost:8089
+# ## InfluxDB's address protocol (udp or http). Default="udp"
+# protocol: udp
+# ## InfluxDB database used when protocol is http. Default=""
+# # database: ""
+# ## InfluxDB retention policy used when protocol is http. Default=""
+# # retentionPolicy: ""
+# ## InfluxDB username (only with http). Default=""
+# # username: ""
+# ## InfluxDB password (only with http). Default=""
+# # password: ""
+# ## The interval used by the exporter to push metrics to influxdb. Default=10s
+# # pushInterval: 30s
+# ## Additional labels (influxdb tags) on all metrics.
+# # additionalLabels:
+# # env: production
+# # foo: bar
+# ## Enable metrics on entry points. Default=true
+# # addEntryPointsLabels: false
+# ## Enable metrics on routers. Default=false
+# # addRoutersLabels: true
+# ## Enable metrics on services. Default=true
+# # addServicesLabels: false
+# influxdb2:
+# ## Address instructs exporter to send metrics to influxdb v2 at this address.
+# address: localhost:8086
+# ## Token with which to connect to InfluxDB v2.
+# token: xxx
+# ## Organisation where metrics will be stored.
+# org: ""
+# ## Bucket where metrics will be stored.
+# bucket: ""
+# ## The interval used by the exporter to push metrics to influxdb. Default=10s
+# # pushInterval: 30s
+# ## Additional labels (influxdb tags) on all metrics.
+# # additionalLabels:
+# # env: production
+# # foo: bar
+# ## Enable metrics on entry points. Default=true
+# # addEntryPointsLabels: false
+# ## Enable metrics on routers. Default=false
+# # addRoutersLabels: true
+# ## Enable metrics on services. Default=true
+# # addServicesLabels: false
+# statsd:
+# ## Address instructs exporter to send metrics to statsd at this address.
+# address: localhost:8125
+# ## The interval used by the exporter to push metrics to influxdb. Default=10s
+# # pushInterval: 30s
+# ## The prefix to use for metrics collection. Default="traefik"
+# # prefix: traefik
+# ## Enable metrics on entry points. Default=true
+# # addEntryPointsLabels: false
+# ## Enable metrics on routers. Default=false
+# # addRoutersLabels: true
+# ## Enable metrics on services. Default=true
+# # addServicesLabels: false
+
+
##
## enable optional CRDs for Prometheus Operator
##
```

## 20.4.1 ![AppVersion: v2.9.4](https://img.shields.io/static/v1?label=AppVersion&message=v2.9.4&color=success&logo=) ![Helm: v3](https://img.shields.io/static/v1?label=Helm&message=v3&color=informational&logo=helm)

**Release date:** 2022-11-21

* 🐛 fix namespace references to support namespaceOverride


## 20.4.0 ![AppVersion: v2.9.4](https://img.shields.io/static/v1?label=AppVersion&message=v2.9.4&color=success&logo=) ![Helm: v3](https://img.shields.io/static/v1?label=Helm&message=v3&color=informational&logo=helm)

**Release date:** 2022-11-18
**Release date:** 2022-11-21

* Add (optional) dedicated metrics service
* Add (optional) dedicated metrics service (#727)

### Default value changes

```diff
diff --git a/traefik/values.yaml b/traefik/values.yaml
index ca15f6a..46690aa 100644
index ca15f6a..e49d02d 100644
--- a/traefik/values.yaml
+++ b/traefik/values.yaml
@@ -266,7 +266,13 @@ metrics:
# address: localhost:8125
@@ -267,6 +267,12 @@ metrics:
##
## enable optional CRDs for Prometheus Operator
##
Expand Down
5 changes: 3 additions & 2 deletions traefik/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: traefik
description: A Traefik based Kubernetes ingress controller
type: application
version: 20.4.1
version: 20.5.0
appVersion: v2.9.4
keywords:
- traefik
Expand All @@ -25,4 +25,5 @@ maintainers:
icon: https://raw.githubusercontent.com/traefik/traefik/v2.3/docs/content/assets/img/traefik.logo.png
annotations:
artifacthub.io/changes: |
- Add (optional) dedicated metrics service
- 🚀 Add complete support on metrics options
- 🐛 make tests use fixed version
110 changes: 101 additions & 9 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -122,28 +122,120 @@
- "--api.dashboard=true"
- "--ping=true"
{{- if .Values.metrics }}
{{- if .Values.metrics.datadog }}
{{- with .Values.metrics.datadog }}
- "--metrics.datadog=true"
{{- if .Values.metrics.datadog.address }}
- "--metrics.datadog.address={{ .Values.metrics.datadog.address }}"
{{- with .address }}
- "--metrics.datadog.address={{ . }}"
{{- end }}
{{- with .pushInterval }}
- "--metrics.datadog.pushInterval={{ . }}"
{{- end }}
{{- if .Values.metrics.influxdb }}
{{- with .prefix }}
- "--metrics.datadog.prefix={{ . }}"
{{- end }}
{{- if .addRoutersLabels}}
- "--metrics.datadog.addRoutersLabels=true"
{{- end }}
{{- if eq .addEntryPointsLabels false }}
- "--metrics.datadog.addEntryPointsLabels=false"
{{- end }}
{{- if eq .addServicesLabels false }}
- "--metrics.datadog.addServicesLabels=false"
{{- end }}
{{- end }}
{{- with .Values.metrics.influxdb }}
- "--metrics.influxdb=true"
- "--metrics.influxdb.address={{ .Values.metrics.influxdb.address }}"
- "--metrics.influxdb.protocol={{ .Values.metrics.influxdb.protocol }}"
- "--metrics.influxdb.address={{ .address }}"
- "--metrics.influxdb.protocol={{ .protocol }}"
{{- with .database }}
- "--metrics.influxdb.database={{ . }}"
{{- end }}
{{- with .retentionPolicy }}
- "--metrics.influxdb.retentionPolicy={{ . }}"
{{- end }}
{{- with .username }}
- "--metrics.influxdb.username={{ . }}"
{{- end }}
{{- with .password }}
- "--metrics.influxdb.password={{ . }}"
{{- end }}
{{- with .pushInterval }}
- "--metrics.influxdb.pushInterval={{ . }}"
{{- end }}
{{- range $name, $value := .additionalLabels }}
- "--metrics.influxdb.additionalLabels.{{ $name }}={{ $value }}"
{{- end }}
{{- if .addRoutersLabels}}
- "--metrics.influxdb.addRoutersLabels=true"
{{- end }}
{{- if eq .addEntryPointsLabels false }}
- "--metrics.influxdb.addEntryPointsLabels=false"
{{- end }}
{{- if eq .addServicesLabels false }}
- "--metrics.influxdb.addServicesLabels=false"
{{- end }}
{{- end }}
{{- with .Values.metrics.influxdb2 }}
- "--metrics.influxdb2=true"
- "--metrics.influxdb2.address={{ .address }}"
- "--metrics.influxdb2.token={{ .token }}"
- "--metrics.influxdb2.org={{ .org }}"
- "--metrics.influxdb2.bucket={{ .bucket }}"
{{- with .pushInterval }}
- "--metrics.influxdb2.pushInterval={{ . }}"
{{- end }}
{{- if .Values.metrics.prometheus }}
{{- range $name, $value := .additionalLabels }}
- "--metrics.influxdb2.additionalLabels.{{ $name }}={{ $value }}"
{{- end }}
{{- if .addRoutersLabels}}
- "--metrics.influxdb2.addRoutersLabels=true"
{{- end }}
{{- if eq .addEntryPointsLabels false }}
- "--metrics.influxdb2.addEntryPointsLabels=false"
{{- end }}
{{- if eq .addServicesLabels false }}
- "--metrics.influxdb2.addServicesLabels=false"
{{- end }}
{{- end }}
{{- if (or .Values.metrics.prometheus .Values.hub.enabled) }}
- "--metrics.prometheus=true"
- "--metrics.prometheus.entrypoint={{ .Values.metrics.prometheus.entryPoint }}"
{{- if (or .Values.metrics.prometheus.addRoutersLabels .Values.hub.enabled) }}
- "--metrics.prometheus.addRoutersLabels=true"
{{- end }}
{{- if eq .Values.metrics.prometheus.addEntryPointsLabels false }}
- "--metrics.prometheus.addEntryPointsLabels=false"
{{- end }}
{{- if eq .Values.metrics.prometheus.addServicesLabels false }}
- "--metrics.prometheus.addServicesLabels=false"
{{- end }}
{{- if .Values.metrics.prometheus.buckets }}
- "--metrics.prometheus.buckets={{ .Values.metrics.prometheus.buckets }}"
{{- end }}
{{- if .Values.metrics.statsd }}
{{- if .Values.metrics.prometheus.manualRouting }}
- "--metrics.prometheus.manualrouting=true"
{{- end }}
{{- end }}
{{- with .Values.metrics.statsd }}
- "--metrics.statsd=true"
- "--metrics.statsd.address={{ .Values.metrics.statsd.address }}"
- "--metrics.statsd.address={{ .address }}"
{{- with .pushInterval }}
- "--metrics.statsd.pushInterval={{ . }}"
{{- end }}
{{- with .prefix }}
- "--metrics.statsd.prefix={{ . }}"
{{- end }}
{{- if .addRoutersLabels}}
- "--metrics.statsd.addRoutersLabels=true"
{{- end }}
{{- if eq .addEntryPointsLabels false }}
- "--metrics.statsd.addEntryPointsLabels=false"
{{- end }}
{{- if eq .addServicesLabels false }}
- "--metrics.statsd.addServicesLabels=false"
{{- end }}
{{- end }}

{{- end }}
{{- if .Values.tracing }}
{{- if .Values.tracing.instana }}
Expand Down
Loading

0 comments on commit 32e1c4f

Please sign in to comment.