Skip to content

Tracing

Tracing in Traefik Proxy allows you to track the flow of operations within your system. Using traces and spans, you can identify performance bottlenecks and pinpoint applications causing slowdowns to optimize response times effectively.

Traefik Proxy uses OpenTelemetry to export traces. OpenTelemetry is an open-source observability framework. You can send traces to an OpenTelemetry collector, which can then export them to a variety of backends like Jaeger, Zipkin, or Datadog.

Configuration

To enable tracing in Traefik Proxy, you need to configure it in your static configuration file or Helm values if you are using the Helm chart. The following example shows how to configure the OpenTelemetry provider to send traces to a collector via HTTP.

tracing:
  otlp:
    http:
      endpoint: http://myotlpcollector:4318/v1/traces
[tracing.otlp.http]
  endpoint = "http://myotlpcollector:4318/v1/traces"
# values.yaml
tracing:
  otlp:
    enabled: true
    http:
      enabled: true
      endpoint: http://myotlpcollector:4318/v1/traces

Info

For detailed configuration options, refer to the tracing reference documentation.

Per-Router Tracing

You can enable or disable tracing for a specific router. This is useful for turning off tracing for specific routes while keeping it on globally.

Here's an example of disabling tracing on a specific router:

http:
  routers:
    my-router:
      rule: "Host(`example.com`)"
      service: my-service
      observability:
        tracing: false
[http.routers.my-router.observability]
  tracing = false
# ingressoute.yaml
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: my-router
spec:
  routes:
    - kind: Rule
      match: Host(`example.com`)
      services:
        - name: my-service
          port: 80
      observability:
        tracing: false
labels:
  - "traefik.http.routers.my-router.observability.tracing=false"
{
  // ...
  "Tags": [
    "traefik.http.routers.my-router.observability.tracing=false"
  ]
}

When the observability options are not defined on a router, it inherits the behavior from the entrypoint's observability configuration, or the global one.