Enable OpenTelemetry
This page explains how to enable OpenTelemetry in the Traefik Hub agent.
Introduction¶
To enable OpenTelemetry, you have to adjust the default configuration of your Traefik Hub agent by adding the following values.
Values¶
Value | Description |
---|---|
hub.metrics.opentelemetry.insecure |
Setting it to true allows Prometheus to connect to the OpenTelemetry endpoint hub.metrics.opentelemetry.address . |
hub.metrics.opentelemetry.address |
The address of your Prometheus instance. This can be an internal (prometheus.monitoring:9090) or external (monitoring.example.com) URL. |
hub.metrics.opentelemetry.path |
The OpenTelemetry endpoint used by the Traefik Hub agent. The default endpoint is /api/v1/otlp/v1/metrics . |
Adjust the configuration¶
If you don't have it already, save the default Traefik Hub configuration.
helm show values traefik/traefik-hub > values.yaml
Second, adjust the values.yaml file by adding the configuration for OpenTelemetry to the additionalArguments
part of the file.
additionalArguments:
- --hub.metrics.opentelemetry.insecure=true
- --hub.metrics.opentelemetry.address=prometheus.monitoring:9090
- --hub.metrics.opentelemetry.path=/api/v1/otlp/v1/metrics
Info
In the shown example above hub.metrics.opentelemetry.address
points to an internal running Prometheus cluster (prometheus.monitoring:9090).
Please check the configuration options for more.
Deploy your custom settings¶
Once the configuration is adjusted, use Helm to (re)deploy the Traefik Hub agent with the new values to enable OpenTelemetry.
helm upgrade --install --namespace traefik-hub traefik-hub traefik/traefik-hub \
--values values.yaml
Congratulations, OpenTelemtry is now enabled.
Helm one-liner
If you prefer, you can also deploy the needed additionalArguments
to enable OpenTelemetry as a "one-liner" command with Helm.
You can do that by adding the additionalArguments
values through --set
.
helm upgrade --install --namespace traefik-hub traefik-hub traefik/traefik-hub \
--set additionalArguments='{--hub.metrics.opentelemetry.insecure,--hub.metrics.opentelemetry.address=prometheus.monitoring:9090,--hub.metrics.opentelemetry.path=/api/v1/otlp/v1/metrics'
Please check the official Helm documentation to learn more about --set
and the use of arrays and list.
What's next¶
- Learn how to utilize Prometheus for Traefik Hub metrics collected by OpenTelemetry