Collect Hub metrics
Introduction¶
You will learn how to use kubectl port-forward
to connect to a Pod running the Traefik Hub Agent and how to use curl
to
send a request to the /metrics endpoint.
Metrics¶
The endpoint will provide base metrics for:
- Status codes
- Response times
- Number of calls
Before you begin¶
You should have access to a working Kubernetes cluster, either on a cloud provider or on your own infrastructure.
This tutorial assumes that you have the Hub Agent and already installed following the installation tutorial.
1. Viewing and finding resources¶
In the first step, you will list all Container images of the traefik or ingress-nginx namespace. To target only pods in a specific namespace, use the namespace flag.
kubectl get pods -n traefik
kubectl get pods -n ingress-nginx
On a basic example cluster the output will show for example:
NAME READY STATUS RESTARTS AGE
traefik-8f4dd6d84-9lr9g 2/2 Running 2 (40m ago) 40m
NAME READY STATUS RESTARTS AGE
ingress-nginx-controller-75fd9b7589-bngn6 2/2 Running 3 (9m23s ago) 9m49s
Note
The name of the Container image in your cluster may look different.
2. Forward a local port to a port on the Pod¶
kubectl port-forward
allows using a resource name, such as a Pod name, to select a matching Pod to port forward to.
kubectl port-forward pods/traefik-8f4dd6d84-9lr9g -n traefik 8888:9001
kubectl port-forward pods/ingress-nginx-controller-75fd9b7589-bngn6 -n ingress-nginx 8888:9001
The output is similar to this:
Forwarding from 127.0.0.1:8888 -> 9001
Forwarding from [::1]:8888 -> 9001
Note
kubectl port-forward
does not return.
To continue with the exercise, you will need to open another terminal.
3. Sending API requests¶
In the last part of this tutorial, you will use curl to interact with the /metrics endpoint.
The following command will perform the request and output the response body:
curl http://localhost:8888/metrics
Which will show the metrics in Prometheus data format.
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 2.357e-05
go_gc_duration_seconds{quantile="0.25"} 5.7942e-05
go_gc_duration_seconds{quantile="0.5"} 0.000107641
go_gc_duration_seconds{quantile="0.75"} 0.000124461
go_gc_duration_seconds{quantile="1"} 0.000663915
go_gc_duration_seconds_sum 0.004804593
go_gc_duration_seconds_count 37
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 8.37443584e+08
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes 1.8446744073709552e+19
# HELP traefik_config_last_reload_failure Last config reload failure
# TYPE traefik_config_last_reload_failure gauge
traefik_config_last_reload_failure 0
# HELP traefik_config_last_reload_success Last config reload success
# TYPE traefik_config_last_reload_success gauge
traefik_config_last_reload_success 1.683531211e+09
# HELP traefik_config_reloads_failure_total Config failure reloads
# TYPE traefik_config_reloads_failure_total counter
traefik_config_reloads_failure_total 0
# HELP traefik_config_reloads_total Config reloads
# TYPE traefik_config_reloads_total counter
traefik_config_reloads_total 8
Show the full example output
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 2.357e-05
go_gc_duration_seconds{quantile="0.25"} 5.7942e-05
go_gc_duration_seconds{quantile="0.5"} 0.000107641
go_gc_duration_seconds{quantile="0.75"} 0.000124461
go_gc_duration_seconds{quantile="1"} 0.000663915
go_gc_duration_seconds_sum 0.004804593
go_gc_duration_seconds_count 37
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 332
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.20.3"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 2.3342528e+07
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 3.14636848e+08
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 1.568263e+06
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 2.510417e+06
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 9.483712e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 2.3342528e+07
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 1.1853824e+07
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 2.7828224e+07
# HELP go_memstats_heap_objects Number of allocated objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 129950
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 1.0092544e+07
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 3.9682048e+07
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 1.6835340919682183e+09
# HELP go_memstats_lookups_total Total number of pointer lookups.
# TYPE go_memstats_lookups_total counter
go_memstats_lookups_total 0
# HELP go_memstats_mallocs_total Total number of mallocs.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 2.640367e+06
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 2400
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 15600
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 355680
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 473280
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 3.527172e+07
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 646033
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 2.260992e+06
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 2.260992e+06
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 5.4129928e+07
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 9
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 8.64
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 37
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 1.02981632e+08
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.68353055021e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 8.37443584e+08
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes 1.8446744073709552e+19
# HELP traefik_config_last_reload_failure Last config reload failure
# TYPE traefik_config_last_reload_failure gauge
traefik_config_last_reload_failure 0
# HELP traefik_config_last_reload_success Last config reload success
# TYPE traefik_config_last_reload_success gauge
traefik_config_last_reload_success 1.683531211e+09
# HELP traefik_config_reloads_failure_total Config failure reloads
# TYPE traefik_config_reloads_failure_total counter
traefik_config_reloads_failure_total 0
# HELP traefik_config_reloads_total Config reloads
# TYPE traefik_config_reloads_total counter
traefik_config_reloads_total 8
# HELP traefik_entrypoint_open_connections How many open connections exist on an entrypoint, partitioned by method and protocol.
# TYPE traefik_entrypoint_open_connections gauge
traefik_entrypoint_open_connections{entrypoint="hub-metrics",method="GET",protocol="http"} 1
traefik_entrypoint_open_connections{entrypoint="hub-secured",method="GET",protocol="http"} 0
traefik_entrypoint_open_connections{entrypoint="hub-tunnel",method="GET",protocol="http"} 0
traefik_entrypoint_open_connections{entrypoint="hub-tunnel",method="OPTIONS",protocol="http"} 0
traefik_entrypoint_open_connections{entrypoint="hub-tunnel",method="POST",protocol="http"} 0
traefik_entrypoint_open_connections{entrypoint="hub-web",method="GET",protocol="http"} 0
traefik_entrypoint_open_connections{entrypoint="hub-web",method="OPTIONS",protocol="http"} 0
# HELP traefik_entrypoint_request_duration_seconds How long it took to process the request on an entrypoint, partitioned by status code, protocol, and method.
# TYPE traefik_entrypoint_request_duration_seconds histogram
traefik_entrypoint_request_duration_seconds_bucket{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http",le="0.1"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http",le="0.3"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http",le="1.2"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http",le="5"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http",le="+Inf"} 1
traefik_entrypoint_request_duration_seconds_sum{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http"} 9.875e-05
traefik_entrypoint_request_duration_seconds_count{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-metrics",method="GET",protocol="http",le="0.1"} 70
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-metrics",method="GET",protocol="http",le="0.3"} 70
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-metrics",method="GET",protocol="http",le="1.2"} 70
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-metrics",method="GET",protocol="http",le="5"} 70
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-metrics",method="GET",protocol="http",le="+Inf"} 70
traefik_entrypoint_request_duration_seconds_sum{code="200",entrypoint="hub-metrics",method="GET",protocol="http"} 0.13523140199999997
traefik_entrypoint_request_duration_seconds_count{code="200",entrypoint="hub-metrics",method="GET",protocol="http"} 70
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-tunnel",method="GET",protocol="http",le="0.1"} 14
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-tunnel",method="GET",protocol="http",le="0.3"} 15
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-tunnel",method="GET",protocol="http",le="1.2"} 15
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-tunnel",method="GET",protocol="http",le="5"} 15
traefik_entrypoint_request_duration_seconds_bucket{code="200",entrypoint="hub-tunnel",method="GET",protocol="http",le="+Inf"} 15
traefik_entrypoint_request_duration_seconds_sum{code="200",entrypoint="hub-tunnel",method="GET",protocol="http"} 0.430448471
traefik_entrypoint_request_duration_seconds_count{code="200",entrypoint="hub-tunnel",method="GET",protocol="http"} 15
traefik_entrypoint_request_duration_seconds_bucket{code="201",entrypoint="hub-tunnel",method="POST",protocol="http",le="0.1"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="201",entrypoint="hub-tunnel",method="POST",protocol="http",le="0.3"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="201",entrypoint="hub-tunnel",method="POST",protocol="http",le="1.2"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="201",entrypoint="hub-tunnel",method="POST",protocol="http",le="5"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="201",entrypoint="hub-tunnel",method="POST",protocol="http",le="+Inf"} 1
traefik_entrypoint_request_duration_seconds_sum{code="201",entrypoint="hub-tunnel",method="POST",protocol="http"} 0.039326801
traefik_entrypoint_request_duration_seconds_count{code="201",entrypoint="hub-tunnel",method="POST",protocol="http"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="302",entrypoint="hub-tunnel",method="GET",protocol="http",le="0.1"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="302",entrypoint="hub-tunnel",method="GET",protocol="http",le="0.3"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="302",entrypoint="hub-tunnel",method="GET",protocol="http",le="1.2"} 2
traefik_entrypoint_request_duration_seconds_bucket{code="302",entrypoint="hub-tunnel",method="GET",protocol="http",le="5"} 2
traefik_entrypoint_request_duration_seconds_bucket{code="302",entrypoint="hub-tunnel",method="GET",protocol="http",le="+Inf"} 2
traefik_entrypoint_request_duration_seconds_sum{code="302",entrypoint="hub-tunnel",method="GET",protocol="http"} 0.569862392
traefik_entrypoint_request_duration_seconds_count{code="302",entrypoint="hub-tunnel",method="GET",protocol="http"} 2
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-secured",method="GET",protocol="http",le="0.1"} 3
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-secured",method="GET",protocol="http",le="0.3"} 3
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-secured",method="GET",protocol="http",le="1.2"} 3
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-secured",method="GET",protocol="http",le="5"} 3
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-secured",method="GET",protocol="http",le="+Inf"} 3
traefik_entrypoint_request_duration_seconds_sum{code="404",entrypoint="hub-secured",method="GET",protocol="http"} 0.0017307669999999998
traefik_entrypoint_request_duration_seconds_count{code="404",entrypoint="hub-secured",method="GET",protocol="http"} 3
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="GET",protocol="http",le="0.1"} 2
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="GET",protocol="http",le="0.3"} 2
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="GET",protocol="http",le="1.2"} 2
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="GET",protocol="http",le="5"} 2
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="GET",protocol="http",le="+Inf"} 2
traefik_entrypoint_request_duration_seconds_sum{code="404",entrypoint="hub-web",method="GET",protocol="http"} 0.0017396669999999999
traefik_entrypoint_request_duration_seconds_count{code="404",entrypoint="hub-web",method="GET",protocol="http"} 2
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http",le="0.1"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http",le="0.3"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http",le="1.2"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http",le="5"} 1
traefik_entrypoint_request_duration_seconds_bucket{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http",le="+Inf"} 1
traefik_entrypoint_request_duration_seconds_sum{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http"} 2.097e-05
traefik_entrypoint_request_duration_seconds_count{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http"} 1
# HELP traefik_entrypoint_requests_bytes_total The total size of requests in bytes handled by an entrypoint, partitioned by status code, protocol, and method.
# TYPE traefik_entrypoint_requests_bytes_total counter
traefik_entrypoint_requests_bytes_total{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http"} 0
traefik_entrypoint_requests_bytes_total{code="200",entrypoint="hub-metrics",method="GET",protocol="http"} 0
traefik_entrypoint_requests_bytes_total{code="200",entrypoint="hub-tunnel",method="GET",protocol="http"} 0
traefik_entrypoint_requests_bytes_total{code="201",entrypoint="hub-tunnel",method="POST",protocol="http"} 19
traefik_entrypoint_requests_bytes_total{code="302",entrypoint="hub-tunnel",method="GET",protocol="http"} 0
traefik_entrypoint_requests_bytes_total{code="404",entrypoint="hub-secured",method="GET",protocol="http"} 0
traefik_entrypoint_requests_bytes_total{code="404",entrypoint="hub-web",method="GET",protocol="http"} 0
traefik_entrypoint_requests_bytes_total{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http"} 0
# HELP traefik_entrypoint_requests_tls_total How many HTTP requests with TLS processed on an entrypoint, partitioned by TLS Version and TLS cipher Used.
# TYPE traefik_entrypoint_requests_tls_total counter
traefik_entrypoint_requests_tls_total{entrypoint="hub-secured",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 1
traefik_entrypoint_requests_tls_total{entrypoint="hub-secured",tls_cipher="TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",tls_version="1.2"} 1
traefik_entrypoint_requests_tls_total{entrypoint="hub-tunnel",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 19
traefik_entrypoint_requests_tls_total{entrypoint="hub-web",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 1
# HELP traefik_entrypoint_requests_total How many HTTP requests processed on an entrypoint, partitioned by status code, protocol, and method.
# TYPE traefik_entrypoint_requests_total counter
traefik_entrypoint_requests_total{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http"} 1
traefik_entrypoint_requests_total{code="200",entrypoint="hub-metrics",method="GET",protocol="http"} 70
traefik_entrypoint_requests_total{code="200",entrypoint="hub-tunnel",method="GET",protocol="http"} 15
traefik_entrypoint_requests_total{code="201",entrypoint="hub-tunnel",method="POST",protocol="http"} 1
traefik_entrypoint_requests_total{code="302",entrypoint="hub-tunnel",method="GET",protocol="http"} 2
traefik_entrypoint_requests_total{code="404",entrypoint="hub-secured",method="GET",protocol="http"} 3
traefik_entrypoint_requests_total{code="404",entrypoint="hub-web",method="GET",protocol="http"} 2
traefik_entrypoint_requests_total{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http"} 1
# HELP traefik_entrypoint_responses_bytes_total The total size of responses in bytes handled by an entrypoint, partitioned by status code, protocol, and method.
# TYPE traefik_entrypoint_responses_bytes_total counter
traefik_entrypoint_responses_bytes_total{code="0",entrypoint="hub-tunnel",method="OPTIONS",protocol="http"} 0
traefik_entrypoint_responses_bytes_total{code="200",entrypoint="hub-metrics",method="GET",protocol="http"} 328421
traefik_entrypoint_responses_bytes_total{code="200",entrypoint="hub-tunnel",method="GET",protocol="http"} 1.874e+06
traefik_entrypoint_responses_bytes_total{code="201",entrypoint="hub-tunnel",method="POST",protocol="http"} 53
traefik_entrypoint_responses_bytes_total{code="302",entrypoint="hub-tunnel",method="GET",protocol="http"} 404
traefik_entrypoint_responses_bytes_total{code="404",entrypoint="hub-secured",method="GET",protocol="http"} 57
traefik_entrypoint_responses_bytes_total{code="404",entrypoint="hub-web",method="GET",protocol="http"} 38
traefik_entrypoint_responses_bytes_total{code="404",entrypoint="hub-web",method="OPTIONS",protocol="http"} 19
# HELP traefik_router_open_connections How many open connections exist on a router, partitioned by service, method, and protocol.
# TYPE traefik_router_open_connections gauge
traefik_router_open_connections{method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_open_connections{method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_open_connections{method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_open_connections{method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_open_connections{method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_open_connections{method="GET",protocol="http",router="[email protected]",service="[email protected]"} 1
traefik_router_open_connections{method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_open_connections{method="POST",protocol="http",router="[email protected]",service="[email protected]"} 0
# HELP traefik_router_request_duration_seconds How long it took to process the request on a router, partitioned by service, status code, protocol, and method.
# TYPE traefik_router_request_duration_seconds histogram
traefik_router_request_duration_seconds_bucket{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 1
traefik_router_request_duration_seconds_bucket{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 1
traefik_router_request_duration_seconds_bucket{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 1
traefik_router_request_duration_seconds_bucket{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]",le="5"} 1
traefik_router_request_duration_seconds_bucket{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 1
traefik_router_request_duration_seconds_sum{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]"} 2.843e-05
traefik_router_request_duration_seconds_count{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]"} 1
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 1
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 1
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 1
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="5"} 1
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 1
traefik_router_request_duration_seconds_sum{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0.015913456
traefik_router_request_duration_seconds_count{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 1
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 4
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 4
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 4
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="5"} 4
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 4
traefik_router_request_duration_seconds_sum{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0.026618766
traefik_router_request_duration_seconds_count{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 4
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 9
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 10
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 10
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="5"} 10
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 10
traefik_router_request_duration_seconds_sum{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0.38723558199999997
traefik_router_request_duration_seconds_count{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 10
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 70
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 70
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 70
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="5"} 70
traefik_router_request_duration_seconds_bucket{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 70
traefik_router_request_duration_seconds_sum{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0.13277165100000002
traefik_router_request_duration_seconds_count{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 70
traefik_router_request_duration_seconds_bucket{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 1
traefik_router_request_duration_seconds_bucket{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 1
traefik_router_request_duration_seconds_bucket{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 1
traefik_router_request_duration_seconds_bucket{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]",le="5"} 1
traefik_router_request_duration_seconds_bucket{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 1
traefik_router_request_duration_seconds_sum{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]"} 0.039268981
traefik_router_request_duration_seconds_count{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]"} 1
traefik_router_request_duration_seconds_bucket{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 1
traefik_router_request_duration_seconds_bucket{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 1
traefik_router_request_duration_seconds_bucket{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 2
traefik_router_request_duration_seconds_bucket{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="5"} 2
traefik_router_request_duration_seconds_bucket{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 2
traefik_router_request_duration_seconds_sum{code="302",method="GET",protocol="http",router="hub[email protected]",service="[email protected]"} 0.56973866
traefik_router_request_duration_seconds_count{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="5"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 2
traefik_router_request_duration_seconds_sum{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0.0016229859999999999
traefik_router_request_duration_seconds_count{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.1"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="0.3"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="1.2"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="5"} 2
traefik_router_request_duration_seconds_bucket{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]",le="+Inf"} 2
traefik_router_request_duration_seconds_sum{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0.0016074750000000001
traefik_router_request_duration_seconds_count{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 2
# HELP traefik_router_requests_bytes_total The total size of requests in bytes handled by a router, partitioned by service, status code, protocol, and method.
# TYPE traefik_router_requests_bytes_total counter
traefik_router_requests_bytes_total{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_requests_bytes_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_requests_bytes_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_requests_bytes_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_requests_bytes_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_requests_bytes_total{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]"} 19
traefik_router_requests_bytes_total{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_requests_bytes_total{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_requests_bytes_total{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 0
# HELP traefik_router_requests_tls_total How many HTTP requests with TLS are processed on a router, partitioned by service, TLS Version, and TLS cipher Used.
# TYPE traefik_router_requests_tls_total counter
traefik_router_requests_tls_total{router="[email protected]",service="[email protected]",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 1
traefik_router_requests_tls_total{router="[email protected]",service="[email protected]",tls_cipher="TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",tls_version="1.2"} 1
traefik_router_requests_tls_total{router="[email protected]",service="[email protected]",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 2
traefik_router_requests_tls_total{router="[email protected]",service="[email protected]",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 6
traefik_router_requests_tls_total{router="[email protected]",service="[email protected]",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 11
# HELP traefik_router_requests_total How many HTTP requests are processed on a router, partitioned by service, status code, protocol, and method.
# TYPE traefik_router_requests_total counter
traefik_router_requests_total{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]"} 1
traefik_router_requests_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 1
traefik_router_requests_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 4
traefik_router_requests_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 10
traefik_router_requests_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 70
traefik_router_requests_total{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]"} 1
traefik_router_requests_total{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 2
traefik_router_requests_total{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 2
traefik_router_requests_total{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 2
# HELP traefik_router_responses_bytes_total The total size of responses in bytes handled by a router, partitioned by service, status code, protocol, and method.
# TYPE traefik_router_responses_bytes_total counter
traefik_router_responses_bytes_total{code="0",method="OPTIONS",protocol="http",router="[email protected]",service="[email protected]"} 0
traefik_router_responses_bytes_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 239
traefik_router_responses_bytes_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 1.866098e+06
traefik_router_responses_bytes_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 7663
traefik_router_responses_bytes_total{code="200",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 328421
traefik_router_responses_bytes_total{code="201",method="POST",protocol="http",router="[email protected]",service="[email protected]"} 53
traefik_router_responses_bytes_total{code="302",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 404
traefik_router_responses_bytes_total{code="404",method="GET",protocol="http",router="default[email protected]",service="[email protected]"} 38
traefik_router_responses_bytes_total{code="404",method="GET",protocol="http",router="[email protected]",service="[email protected]"} 38
# HELP traefik_service_open_connections How many open connections exist on a service, partitioned by method and protocol.
# TYPE traefik_service_open_connections gauge
traefik_service_open_connections{method="GET",protocol="http",service="[email protected]"} 0
traefik_service_open_connections{method="GET",protocol="http",service="[email protected]"} 0
traefik_service_open_connections{method="GET",protocol="http",service="[email protected]"} 0
traefik_service_open_connections{method="POST",protocol="http",service="[email protected]"} 0
# HELP traefik_service_request_duration_seconds How long it took to process the request on a service, partitioned by status code, protocol, and method.
# TYPE traefik_service_request_duration_seconds histogram
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="0.1"} 1
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="0.3"} 1
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="1.2"} 1
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="5"} 1
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="+Inf"} 1
traefik_service_request_duration_seconds_sum{code="200",method="GET",protocol="http",service="[email protected]"} 0.015852436
traefik_service_request_duration_seconds_count{code="200",method="GET",protocol="http",service="[email protected]"} 1
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="0.1"} 14
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="0.3"} 14
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="1.2"} 14
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="5"} 14
traefik_service_request_duration_seconds_bucket{code="200",method="GET",protocol="http",service="[email protected]",le="+Inf"} 14
traefik_service_request_duration_seconds_sum{code="200",method="GET",protocol="http",service="[email protected]"} 0.26750005
traefik_service_request_duration_seconds_count{code="200",method="GET",protocol="http",service="[email protected]"} 14
traefik_service_request_duration_seconds_bucket{code="201",method="POST",protocol="http",service="[email protected]",le="0.1"} 1
traefik_service_request_duration_seconds_bucket{code="201",method="POST",protocol="http",service="[email protected]",le="0.3"} 1
traefik_service_request_duration_seconds_bucket{code="201",method="POST",protocol="http",service="[email protected]",le="1.2"} 1
traefik_service_request_duration_seconds_bucket{code="201",method="POST",protocol="http",service="[email protected]",le="5"} 1
traefik_service_request_duration_seconds_bucket{code="201",method="POST",protocol="http",service="[email protected]",le="+Inf"} 1
traefik_service_request_duration_seconds_sum{code="201",method="POST",protocol="http",service="[email protected]"} 0.03705223
traefik_service_request_duration_seconds_count{code="201",method="POST",protocol="http",service="[email protected]"} 1
traefik_service_request_duration_seconds_bucket{code="404",method="GET",protocol="http",service="[email protected]",le="0.1"} 4
traefik_service_request_duration_seconds_bucket{code="404",method="GET",protocol="http",service="[email protected]",le="0.3"} 4
traefik_service_request_duration_seconds_bucket{code="404",method="GET",protocol="http",service="[email protected]",le="1.2"} 4
traefik_service_request_duration_seconds_bucket{code="404",method="GET",protocol="http",service="[email protected]b",le="5"} 4
traefik_service_request_duration_seconds_bucket{code="404",method="GET",protocol="http",service="[email protected]",le="+Inf"} 4
traefik_service_request_duration_seconds_sum{code="404",method="GET",protocol="http",service="[email protected]"} 0.00305666
traefik_service_request_duration_seconds_count{code="404",method="GET",protocol="http",service="[email protected]"} 4
# HELP traefik_service_requests_bytes_total The total size of requests in bytes received by a service, partitioned by status code, protocol, and method.
# TYPE traefik_service_requests_bytes_total counter
traefik_service_requests_bytes_total{code="200",method="GET",protocol="http",service="[email protected]"} 0
traefik_service_requests_bytes_total{code="200",method="GET",protocol="http",service="[email protected]"} 0
traefik_service_requests_bytes_total{code="201",method="POST",protocol="http",service="[email protected]"} 19
traefik_service_requests_bytes_total{code="404",method="GET",protocol="http",service="[email protected]"} 0
# HELP traefik_service_requests_tls_total How many HTTP requests with TLS processed on a service, partitioned by TLS version and TLS cipher.
# TYPE traefik_service_requests_tls_total counter
traefik_service_requests_tls_total{service="[email protected]",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 1
traefik_service_requests_tls_total{service="[email protected]",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 1
traefik_service_requests_tls_total{service="[email protected]",tls_cipher="TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",tls_version="1.2"} 1
traefik_service_requests_tls_total{service="[email protected]",tls_cipher="TLS_AES_128_GCM_SHA256",tls_version="1.3"} 15
# HELP traefik_service_requests_total How many HTTP requests processed on a service, partitioned by status code, protocol, and method.
# TYPE traefik_service_requests_total counter
traefik_service_requests_total{code="200",method="GET",protocol="http",service="[email protected]"} 1
traefik_service_requests_total{code="200",method="GET",protocol="http",service="[email protected]"} 14
traefik_service_requests_total{code="201",method="POST",protocol="http",service="[email protected]"} 1
traefik_service_requests_total{code="404",method="GET",protocol="http",service="[email protected]"} 4
# HELP traefik_service_responses_bytes_total The total size of responses in bytes returned by a service, partitioned by status code, protocol, and method.
# TYPE traefik_service_responses_bytes_total counter
traefik_service_responses_bytes_total{code="200",method="GET",protocol="http",service="[email protected]"} 239
traefik_service_responses_bytes_total{code="200",method="GET",protocol="http",service="[email protected]"} 1.873761e+06
traefik_service_responses_bytes_total{code="201",method="POST",protocol="http",service="[email protected]"} 53
traefik_service_responses_bytes_total{code="404",method="GET",protocol="http",service="[email protected]"} 76
Summary¶
In this tutorial, you learned how to:
- Use
kubectl port-forward
to connect to a Traefik Hub Agent. - Use
curl
to request metrics in Prometheus format