Support InfluxDB v2 metrics backend

This commit is contained in:
Dmitry Sharshakov 2022-02-09 17:32:12 +03:00 committed by GitHub
parent 5780dc2b15
commit ca55dfe1c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 681 additions and 49 deletions

View file

@ -0,0 +1,219 @@
# InfluxDB v2
To enable the InfluxDB2:
```yaml tab="File (YAML)"
metrics:
influxDB2: {}
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
```
```bash tab="CLI"
--metrics.influxdb2=true
```
#### `address`
_Required, Default="http://localhost:8086"_
Address of the InfluxDB v2 instance.
```yaml tab="File (YAML)"
metrics:
influxDB2:
address: http://localhost:8086
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
address = "http://localhost:8086"
```
```bash tab="CLI"
--metrics.influxdb2.address=http://localhost:8086
```
#### `token`
_Required, Default=""_
Token with which to connect to InfluxDB v2.
```yaml tab="File (YAML)"
metrics:
influxDB2:
token: secret
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
token = "secret"
```
```bash tab="CLI"
--metrics.influxdb2.token=secret
```
#### `org`
_Required, Default=""_
Organisation where metrics will be stored.
```yaml tab="File (YAML)"
metrics:
influxDB2:
org: my-org
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
org = "my-org"
```
```bash tab="CLI"
--metrics.influxdb2.org=my-org
```
#### `bucket`
_Required, Default=""_
Bucket where metrics will be stored.
```yaml tab="File (YAML)"
metrics:
influxDB2:
bucket: my-bucket
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
bucket = "my-bucket"
```
```bash tab="CLI"
--metrics.influxdb2.bucket=my-bucket
```
#### `addEntryPointsLabels`
_Optional, Default=true_
Enable metrics on entry points.
```yaml tab="File (YAML)"
metrics:
influxDB2:
addEntryPointsLabels: true
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
addEntryPointsLabels = true
```
```bash tab="CLI"
--metrics.influxdb2.addEntryPointsLabels=true
```
#### `addRoutersLabels`
_Optional, Default=false_
Enable metrics on routers.
```yaml tab="File (YAML)"
metrics:
influxDB2:
addRoutersLabels: true
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
addRoutersLabels = true
```
```bash tab="CLI"
--metrics.influxdb2.addrouterslabels=true
```
#### `addServicesLabels`
_Optional, Default=true_
Enable metrics on services.
```yaml tab="File (YAML)"
metrics:
influxDB2:
addServicesLabels: true
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
addServicesLabels = true
```
```bash tab="CLI"
--metrics.influxdb2.addServicesLabels=true
```
#### `pushInterval`
_Optional, Default=10s_
The interval used by the exporter to push metrics to InfluxDB server.
```yaml tab="File (YAML)"
metrics:
influxDB2:
pushInterval: 10s
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
pushInterval = "10s"
```
```bash tab="CLI"
--metrics.influxdb2.pushInterval=10s
```
#### `additionalLabels`
_Optional, Default={}_
Additional labels (InfluxDB tags) on all metrics.
```yaml tab="File (YAML)"
metrics:
influxDB2:
additionalLabels:
host: example.com
environment: production
```
```toml tab="File (TOML)"
[metrics]
[metrics.influxDB2]
[metrics.influxDB2.additionalLabels]
host = "example.com"
environment = "production"
```
```bash tab="CLI"
--metrics.influxdb2.additionallabels.host=example.com --metrics.influxdb2.additionallabels.environment=production
```

View file

@ -4,16 +4,17 @@ Traefik supports 4 metrics backends:
- [Datadog](./datadog.md)
- [InfluxDB](./influxdb.md)
- [InfluxDB2](./influxdb2.md)
- [Prometheus](./prometheus.md)
- [StatsD](./statsd.md)
## Global Metrics
| Metric | DataDog | InfluxDB | Prometheus | StatsD |
|-------------------------------------------------------------------------|---------|----------|------------|--------|
| [Configuration reloads](#configuration-reloads) | ✓ | ✓ | ✓ | ✓ |
| [Last Configuration Reload Success](#last-configuration-reload-success) | ✓ | ✓ | ✓ | ✓ |
| [TLS certificates expiration](#tls-certificates-expiration) | ✓ | ✓ | ✓ | ✓ |
| Metric | DataDog | InfluxDB / InfluxDB2 | Prometheus | StatsD |
|-------------------------------------------------------------------------|---------|----------------------|------------|--------|
| [Configuration reloads](#configuration-reloads) | ✓ | ✓ | ✓ | ✓ |
| [Last Configuration Reload Success](#last-configuration-reload-success) | ✓ | ✓ | ✓ | ✓ |
| [TLS certificates expiration](#tls-certificates-expiration) | ✓ | ✓ | ✓ | ✓ |
### Configuration Reloads
@ -23,7 +24,7 @@ The total count of configuration reloads.
config.reload.total
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.config.reload.total
```
@ -44,7 +45,7 @@ The timestamp of the last configuration reload success.
config.reload.lastSuccessTimestamp
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.config.reload.lastSuccessTimestamp
```
@ -67,7 +68,7 @@ Available labels: `cn`, `sans`, `serial`.
tls.certs.notAfterTimestamp
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.tls.certs.notAfterTimestamp
```
@ -82,12 +83,12 @@ traefik_tls_certs_not_after
## EntryPoint Metrics
| Metric | DataDog | InfluxDB | Prometheus | StatsD |
|-----------------------------------------------------------|---------|----------|------------|--------|
| [HTTP Requests Count](#http-requests-count) | ✓ | ✓ | ✓ | ✓ |
| [HTTPS Requests Count](#https-requests-count) | ✓ | ✓ | ✓ | ✓ |
| [Request Duration Histogram](#request-duration-histogram) | ✓ | ✓ | ✓ | ✓ |
| [Open Connections Count](#open-connections-count) | ✓ | ✓ | ✓ | ✓ |
| Metric | DataDog | InfluxDB / InfluxDB2 | Prometheus | StatsD |
|-----------------------------------------------------------|---------|----------------------|------------|--------|
| [HTTP Requests Count](#http-requests-count) | ✓ | ✓ | ✓ | ✓ |
| [HTTPS Requests Count](#https-requests-count) | ✓ | ✓ | ✓ | ✓ |
| [Request Duration Histogram](#request-duration-histogram) | ✓ | ✓ | ✓ | ✓ |
| [Open Connections Count](#open-connections-count) | ✓ | ✓ | ✓ | ✓ |
### HTTP Requests Count
@ -99,7 +100,7 @@ Available labels: `code`, `method`, `protocol`, `entrypoint`.
entrypoint.request.total
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.entrypoint.requests.total
```
@ -122,7 +123,7 @@ Available labels: `tls_version`, `tls_cipher`, `entrypoint`.
entrypoint.request.tls.total
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.entrypoint.requests.tls.total
```
@ -145,7 +146,7 @@ Available labels: `code`, `method`, `protocol`, `entrypoint`.
entrypoint.request.duration
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.entrypoint.request.duration
```
@ -168,7 +169,7 @@ Available labels: `method`, `protocol`, `entrypoint`.
entrypoint.connections.open
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.entrypoint.connections.open
```
@ -183,12 +184,12 @@ traefik_entrypoint_open_connections
## Router Metrics
| Metric | DataDog | InfluxDB | Prometheus | StatsD |
|-------------------------------------------------------------|---------|----------|------------|--------|
| [HTTP Requests Count](#http-requests-count_1) | ✓ | ✓ | ✓ | ✓ |
| [HTTPS Requests Count](#https-requests-count_1) | ✓ | ✓ | ✓ | ✓ |
| [Request Duration Histogram](#request-duration-histogram_1) | ✓ | ✓ | ✓ | ✓ |
| [Open Connections Count](#open-connections-count_1) | ✓ | ✓ | ✓ | ✓ |
| Metric | DataDog | InfluxDB / InfluxDB2 | Prometheus | StatsD |
|-------------------------------------------------------------|---------|----------------------|------------|--------|
| [HTTP Requests Count](#http-requests-count_1) | ✓ | ✓ | ✓ | ✓ |
| [HTTPS Requests Count](#https-requests-count_1) | ✓ | ✓ | ✓ | ✓ |
| [Request Duration Histogram](#request-duration-histogram_1) | ✓ | ✓ | ✓ | ✓ |
| [Open Connections Count](#open-connections-count_1) | ✓ | ✓ | ✓ | ✓ |
### HTTP Requests Count
@ -200,7 +201,7 @@ Available labels: `code`, `method`, `protocol`, `router`, `service`.
router.request.total
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.router.requests.total
```
@ -223,7 +224,7 @@ Available labels: `tls_version`, `tls_cipher`, `router`, `service`.
router.request.tls.total
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.router.requests.tls.total
```
@ -246,7 +247,7 @@ Available labels: `code`, `method`, `protocol`, `router`, `service`.
router.request.duration
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.router.request.duration
```
@ -269,7 +270,7 @@ Available labels: `method`, `protocol`, `router`, `service`.
router.connections.open
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.router.connections.open
```
@ -284,14 +285,14 @@ traefik_router_open_connections
## Service Metrics
| Metric | DataDog | InfluxDB | Prometheus | StatsD |
|-------------------------------------------------------------|---------|----------|------------|--------|
| [HTTP Requests Count](#http-requests-count_2) | ✓ | ✓ | ✓ | ✓ |
| [HTTPS Requests Count](#https-requests-count_2) | ✓ | ✓ | ✓ | ✓ |
| [Request Duration Histogram](#request-duration-histogram_2) | ✓ | ✓ | ✓ | ✓ |
| [Open Connections Count](#open-connections-count_2) | ✓ | ✓ | ✓ | ✓ |
| [Requests Retries Count](#requests-retries-count) | ✓ | ✓ | ✓ | ✓ |
| [Service Server UP](#service-server-up) | ✓ | ✓ | ✓ | ✓ |
| Metric | DataDog | InfluxDB / InfluxDB2 | Prometheus | StatsD |
|-------------------------------------------------------------|---------|----------------------|------------|--------|
| [HTTP Requests Count](#http-requests-count_2) | ✓ | ✓ | ✓ | ✓ |
| [HTTPS Requests Count](#https-requests-count_2) | ✓ | ✓ | ✓ | ✓ |
| [Request Duration Histogram](#request-duration-histogram_2) | ✓ | ✓ | ✓ | ✓ |
| [Open Connections Count](#open-connections-count_2) | ✓ | ✓ | ✓ | ✓ |
| [Requests Retries Count](#requests-retries-count) | ✓ | ✓ | ✓ | ✓ |
| [Service Server UP](#service-server-up) | ✓ | ✓ | ✓ | ✓ |
### HTTP Requests Count
@ -303,7 +304,7 @@ Available labels: `code`, `method`, `protocol`, `service`.
service.request.total
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.service.requests.total
```
@ -326,7 +327,7 @@ Available labels: `tls_version`, `tls_cipher`, `service`.
router.service.tls.total
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.service.requests.tls.total
```
@ -349,7 +350,7 @@ Available labels: `code`, `method`, `protocol`, `service`.
service.request.duration
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.service.request.duration
```
@ -372,7 +373,7 @@ Available labels: `method`, `protocol`, `service`.
service.connections.open
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.service.connections.open
```
@ -395,7 +396,7 @@ Available labels: `service`.
service.retries.total
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.service.retries.total
```
@ -418,7 +419,7 @@ Available labels: `service`, `url`.
service.server.up
```
```influxdb tab="InfluxDB"
```influxdb tab="InfluxDB / InfluxDB2"
traefik.service.server.up
```

View file

@ -285,6 +285,36 @@ InfluxDB retention policy used when protocol is http.
`--metrics.influxdb.username`:
InfluxDB username (only with http).
`--metrics.influxdb2`:
InfluxDB v2 metrics exporter type. (Default: ```false```)
`--metrics.influxdb2.addentrypointslabels`:
Enable metrics on entry points. (Default: ```true```)
`--metrics.influxdb2.additionallabels.<name>`:
Additional labels (influxdb tags) on all metrics
`--metrics.influxdb2.address`:
InfluxDB v2 address. (Default: ```http://localhost:8086```)
`--metrics.influxdb2.addrouterslabels`:
Enable metrics on routers. (Default: ```false```)
`--metrics.influxdb2.addserviceslabels`:
Enable metrics on services. (Default: ```true```)
`--metrics.influxdb2.bucket`:
InfluxDB v2 bucket ID.
`--metrics.influxdb2.org`:
InfluxDB v2 org ID.
`--metrics.influxdb2.pushinterval`:
InfluxDB v2 push interval. (Default: ```10```)
`--metrics.influxdb2.token`:
InfluxDB v2 access token.
`--metrics.prometheus`:
Prometheus metrics exporter type. (Default: ```false```)

View file

@ -252,6 +252,36 @@ Datadog push interval. (Default: ```10```)
`TRAEFIK_METRICS_INFLUXDB`:
InfluxDB metrics exporter type. (Default: ```false```)
`TRAEFIK_METRICS_INFLUXDB2`:
InfluxDB v2 metrics exporter type. (Default: ```false```)
`TRAEFIK_METRICS_INFLUXDB2_ADDENTRYPOINTSLABELS`:
Enable metrics on entry points. (Default: ```true```)
`TRAEFIK_METRICS_INFLUXDB2_ADDITIONALLABELS_<NAME>`:
Additional labels (influxdb tags) on all metrics
`TRAEFIK_METRICS_INFLUXDB2_ADDRESS`:
InfluxDB v2 address. (Default: ```http://localhost:8086```)
`TRAEFIK_METRICS_INFLUXDB2_ADDROUTERSLABELS`:
Enable metrics on routers. (Default: ```false```)
`TRAEFIK_METRICS_INFLUXDB2_ADDSERVICESLABELS`:
Enable metrics on services. (Default: ```true```)
`TRAEFIK_METRICS_INFLUXDB2_BUCKET`:
InfluxDB v2 bucket ID.
`TRAEFIK_METRICS_INFLUXDB2_ORG`:
InfluxDB v2 org ID.
`TRAEFIK_METRICS_INFLUXDB2_PUSHINTERVAL`:
InfluxDB v2 push interval. (Default: ```10```)
`TRAEFIK_METRICS_INFLUXDB2_TOKEN`:
InfluxDB v2 access token.
`TRAEFIK_METRICS_INFLUXDB_ADDENTRYPOINTSLABELS`:
Enable metrics on entry points. (Default: ```true```)

View file

@ -281,6 +281,17 @@
addServicesLabels = true
[metrics.influxDB.additionalLabels]
foobar = "foobar"
[metrics.influxDB2]
address = "foobar"
token = "foobar"
pushInterval = "42s"
org = "foobar"
bucket = "foobar"
addEntryPointsLabels = true
addRoutersLabels = true
addServicesLabels = true
[metrics.influxDB2.additionalLabels]
foobar = "foobar"
[ping]
entryPoint = "foobar"

View file

@ -303,6 +303,18 @@ metrics:
addServicesLabels: true
additionalLabels:
foobar: foobar
influxDB2:
address: foobar
token: foobar
pushInterval: 42s
org: foobar
bucket: foobar
addEntryPointsLabels: true
addRoutersLabels: true
addServicesLabels: true
additionalLabels:
foobar: foobar
ping:
entryPoint: foobar
manualRouting: true