⏱ metrics-process
This crate provides Prometheus style process metrics collector of metrics crate.
Supported metrics
This crate supports the following metrics, equal to what official prometheus client of go (client_golang) provides.
Metric name | Help string | Linux | macOS | Windows |
---|---|---|---|---|
process_cpu_seconds_total |
Total user and system CPU time spent in seconds. | x | x | x |
process_open_fds |
Number of open file descriptors. | x | x | x |
process_max_fds |
Maximum number of open file descriptors. | x | x | x |
process_virtual_memory_bytes |
Virtual memory size in bytes. | x | x | x |
process_virtual_memory_max_bytes |
Maximum amount of virtual memory available in bytes. | x | x | |
process_resident_memory_bytes |
Resident memory size in bytes. | x | x | x |
process_heap_bytes |
Process heap size in bytes. | |||
process_start_time_seconds |
Start time of the process since unix epoch in seconds. | x | x | x |
process_threads |
Number of OS threads in the process. | x | x |
Usage
Use this crate with metrics-exporter-prometheus as an exporter like:
use thread;
use ;
use PrometheusBuilder;
use Collector;
Or with axum (or any web application framework you like) to collect metrics whenever
the /metrics
endpoint is invoked like:
use ;
use PrometheusBuilder;
use Collector;
async
License
The code follows MIT license written in LICENSE. Contributors need to agree that any modifications sent in this repository follow the license.