Monitoring Traefik

Instana has the ability to collect both metrics and distributed traces of requests that pass through Traefik.

The Traefik sensor is automatically deployed and installed after you install the Instana agent.

Agent Configuration

You can configure the following fields in the agent configuration file:

com.instana.plugin.traefik:
  enabled: true
  poll_rate: 1 # seconds

Configuration

In order to display metrics and tracing information, the corresponding features must be enabled in your installation of Traefik.

Metrics collection

To view the metrics, select Infrastructure in the sidebar of the Instana User interface, click a specific monitored host, and then you can see a host dashboard with all the collected metrics and monitored processes.

Configuration Data

  • PID
  • Version
  • Start Time

Performance Metrics

Metric Description Granularity
HTTP requests per second HTTP requests per second 1 second
Config's last reload success Time of the last successful configuration reload 1 second
Number of config reloads Number of config reloads per second 1 second
Entrypoints HTTP requests per second per entry point 1 second

The maximum number entry points that can be monitored is limited to 100.

Enabling Metrics Collection

To enable metrics collection from the Traefik app, it has to expose an endpoint with Prometheus metrics. There are multiple ways to do it:

  • using a configuration file (YAML or TOML format)
  • setting environment variables
  • adding command line arguments

For example these lines in the config file will expose metrics on :8888/metrics:

#config.yaml
entryPoints:
  metrics:
    address: ":8888"

metrics:
  prometheus:
    entryPoint: metrics

Metrics endpoint must be accessible from the Instana Agent.

More examples can be found on the Traefik website.

Enabling Tracing

To enable tracing in the Traefik app, it has to be configured. There are multiple ways to do it:

  • using a configuration file (YAML or TOML format)
  • setting environment variables
  • adding command line arguments

For example:

#config.yaml
tracing:
  instana: {}

Instana Agent must be accessible from the Traefik application.

More examples can be found on the Traefik [website]https://doc.traefik.io/traefik-enterprise/operations/metrics/instana/).

Traefik Helm Chart

To use the official Traefik Proxy Helm Chart, you need to explicitly provide configuration to enable Instana Tracing and expose the Traefik Prometheus metrics like this:

helm install \
  --set="additionalArguments={--tracing.instana=true}" \
  --set ports.metrics.port=8080 \
  --set ports.metrics.exposedPort=8080 \
  traefik \
  traefik/traefik

Troubleshooting

Monitoring issue type: traefik_metrics_api_not_accessible

To resolve this issue refer to the steps as described in Enabling Metrics Collection for how to configure Traefik application to expose metrics endpoint.

Monitoring issue type: traefik_metrics_api_not_enabled

To resolve this issue refer to the steps as described in Enabling Metrics Collection for how to configure Traefik application to expose metrics endpoint.

Monitoring issue type: traefik_tracing_not_enabled

To resolve this issue refer to the steps as described in Enabling Tracing for how to enable tracing in the Traefik application.