This change replaces the metrics feature with a prometheus-client feature. prometheus-client is the official Prometheus-org OpenMetrics implementation.
The watch-pods example has been updated to export prometheus metrics:
:; curl localhost:8080/metrics
# HELP watch_pods_events Number of events observed.
# TYPE watch_pods_events counter
watch_pods_events_total{op="apply"} 0
watch_pods_events_total{op="delete"} 0
watch_pods_events_total{op="restart"} 1
# HELP watch_pods_current_pods Number of Pods being observed.
# TYPE watch_pods_current_pods gauge
watch_pods_current_pods 10
# HELP watch_pods_pods Total number of unique pods observed.
# TYPE watch_pods_pods counter
watch_pods_pods_total 10
# HELP process_start_time_seconds Time that the process started (in seconds since the UNIX epoch).
# TYPE process_start_time_seconds gauge
# UNIT process_start_time_seconds seconds
process_start_time_seconds 1702159727.213669
# HELP process_uptime_seconds Total time since the process started (in seconds)
# TYPE process_uptime_seconds counter
# UNIT process_uptime_seconds seconds
process_uptime_seconds_total 2.712104395
# HELP process_cpu_seconds Total user and system CPU time spent in seconds
# TYPE process_cpu_seconds counter
# UNIT process_cpu_seconds seconds
process_cpu_seconds_total 0.73
# HELP process_virtual_memory_bytes Virtual memory size in bytes
# TYPE process_virtual_memory_bytes gauge
# UNIT process_virtual_memory_bytes bytes
process_virtual_memory_bytes 1208897536
# HELP process_resident_memory_bytes Resident memory size in bytes
# TYPE process_resident_memory_bytes gauge
# UNIT process_resident_memory_bytes bytes
process_resident_memory_bytes 21114880
# HELP process_open_fds Number of open file descriptors
# TYPE process_open_fds gauge
process_open_fds 16
# HELP process_max_fds Maximum number of open file descriptors
# TYPE process_max_fds gauge
process_max_fds 1048576
# HELP process_threads Number of OS threads in the process.
# TYPE process_threads gauge
process_threads 18
# EOF
Furthermore, admin::Builder APIs are updated to consume the builder and return it by-value (instead of handling references, which does not work well when chaining configuration). This is based on the experience of integrating prometheus into the example.
Additionally, the admin server has been updated to use spawn_blocking for non-probe handlers.
To support this, a new kubert-prometheus-process crate has been added, including only the procfs bindings needed to support the process metrics. This crate is completely decoupled from kubert. It is based on the process metrics implementation in the linkerd2-proxy repo.
This change replaces the
metrics
feature with aprometheus-client
feature. prometheus-client is the official Prometheus-org OpenMetrics implementation.The watch-pods example has been updated to export prometheus metrics:
Furthermore,
admin::Builder
APIs are updated to consume the builder and return it by-value (instead of handling references, which does not work well when chaining configuration). This is based on the experience of integrating prometheus into the example.Additionally, the admin server has been updated to use spawn_blocking for non-probe handlers.
To support this, a new kubert-prometheus-process crate has been added, including only the procfs bindings needed to support the process metrics. This crate is completely decoupled from kubert. It is based on the process metrics implementation in the linkerd2-proxy repo.