Traefik
Collect Traefik Metrics information
Installation and Configuration¶
Prerequisites¶
- Install DataKit
Traefik Configuration¶
Metrics¶
Traefik supports exposing Metrics via the Prometheus protocol by default. Add the following configuration to the Traefik configuration file:
[entryPoints]
[entryPoints.metrics]
address = ":9100"
[metrics]
[metrics.prometheus]
entryPoint = "metrics"
buckets = [0.1, 0.3, 1.2, 5.0]
Traces¶
Traefik supports reporting trace information through the Zipkin protocol. Add the following configuration to the Traefik configuration file:
[tracing]
serviceName= "traefik-service"
[tracing.zipkin]
httpEndpoint = "http://<datakit-ip>:9529/api/v2/spans"
sameSpan = true
id128Bit = true
sampleRate = 1.0
Logs¶
Enable logging functionality by adding the following configuration to the Traefik configuration file, adjust level
as needed:
DataKit Configuration¶
Metrics¶
To collect Traefik Metrics, navigate to the conf.d/prom
directory under the DataKit installation directory and execute the following command:
cp prom.conf.sample traefik.conf
Adjust the content of traefik.conf
, primarily adjusting urls
, as follows:
[[inputs.prom]]
## Exporter URLs.
urls = ["http://127.0.0.1:9100/metrics"]
measurement_name = "Traefik"
Other configurations can be adjusted as needed, parameter adjustment description:
- urls: The
prometheus
Metrics address; here, fill in the Metrics URL exposed by the corresponding component. - source: Collector alias, it is recommended to make distinctions.
- interval: Collection interval.
Traces¶
The DataKit collector collects Traefik trace data. Navigate to the conf.d/zipkin
directory under the DataKit installation directory and execute the following command:
cp zipkin.conf.sample zipkin.conf
No adjustments are required for the content.
Logs¶
To collect Traefik logs, navigate to the conf.d/log
directory under the DataKit installation directory and execute the following command:
cp log.conf.sample traefik.conf
Adjust the logfiles
content in traefik.conf
as follows:
[[inputs.logging]]
## Required
## File names or a pattern to tail.
logfiles = [
"/var/log/traefik.log",
]
Restart DataKit¶
After making adjustments, restart DataKit.
Metrics¶
Metric Set Traefik
¶
Metric | Description | Unit |
---|---|---|
traefik_config_last_reload_failure |
Timestamp of the last configuration reload failure | s |
traefik_config_last_reload_success |
Timestamp of the last successful configuration reload | s |
traefik_config_reloads_failure_total |
Total number of configuration reload failures | count |
traefik_config_reloads_total |
Total number of configuration reloads | count |
traefik_entrypoint_open_connections |
Number of currently open connections at an entry point | count |
traefik_entrypoint_request_duration_seconds_bucket |
Histogram bucket for request processing time | s |
traefik_entrypoint_request_duration_seconds_count |
Histogram count for request processing time | count |
traefik_entrypoint_request_duration_seconds_sum |
Sum of request processing times | s |
traefik_entrypoint_requests_bytes_total |
Total bytes of processed requests | byte |
traefik_entrypoint_requests_total |
Number of processed requests | count |
traefik_entrypoint_responses_bytes_total |
Total bytes of processed responses | count |
traefik_router_open_connections |
Number of currently open connections at a router | count |
traefik_router_request_duration_seconds_bucket |
Histogram bucket for request processing time | s |
traefik_router_request_duration_seconds_count |
Histogram count for request processing time | count |
traefik_router_request_duration_seconds_sum |
Sum of request processing times | s |
traefik_router_requests_bytes_total |
Total bytes of processed requests | byte |
traefik_router_requests_total |
Number of processed requests | count |
traefik_router_responses_bytes_total |
Total bytes of processed responses | byte |
traefik_service_open_connections |
Number of currently open connections at a service | count |
traefik_service_request_duration_seconds_bucket |
Histogram bucket for request processing time | s |
traefik_service_request_duration_seconds_count |
Histogram count for request processing time | count |
traefik_service_request_duration_seconds_sum |
Sum of request processing times | s |
traefik_service_requests_total |
Number of processed requests | count |
traefik_service_responses_bytes_total |
Total bytes of processed responses | byte |