InfluxDB2 Metrics, Static config and env variables

Hello
I'm trying to set the InfluxDB2 token and org via the following env variables:

TRAEFIK_METRICS_INFLUXDB2_ORG:
TRAEFIK_METRICS_INFLUXDB2_TOKEN:

These are set in a .env file loaded from the docker-compose yaml file

the traefik.yml static config file has:

metrics:
  influxDB2:
    address: http://influxdb:8086
    bucket: "traefik_bucket"
    addEntryPointsLabels: true
    addServicesLabels: true
    pushInterval: 10s

If I run docker exec -it traefik /bin/sh and then execute "env", it returns

TRAEFIK_METRICS_INFLUXDB2_TOKEN=<correct token>
TRAEFIK_METRICS_INFLUXDB2_ORG=<correct org>

However, Traefik logs:

level=error msg="token, org or bucket property is missing" metricsProviderName=influxdb2

How can I fix this? I don't want to add the actual token to the static config file. I would like to be able to specify that in the env file so that it is set when the container is created and loaded.

Thank you in advance

The error mentions bucket also. Try adding that ?

Caveat: I haven't used influxdb with treafik metrics.

@cakiwi Thank you.

I've already tried that but still got the same error.

Hi all
Just reading "Traefik Configuration Documentation - Traefik"
specifically the part about static configuration
It says that the options are mutually exclusive (i.e. you can use only one at the same time)

Does this mean that because the static file contains:

metrics:
  influxDB2:
    address: http://influxdb:8086

That the rest of the options will not be taken from the env variables?

I'm a little confused because this looks like a bug to me. I can understand why it would ignore the values in the env variable IF the static file already contains a value for "Token" for example but not if the option is not there!

Any devs reading this willing to shed some light?

Thank you in advance