Crate mz_process_collector[][src]

Detailed metrics for the current process

This crate replaces the rust-prometheus process feature, which is designed to exactly match the fields documented as part of the Prometheus process metrics.

This currently only works on linux, due to library support.

Initialize this exactly once at program startup, and then handle scrapes following the prometheus instructions:

fn main() -> Result<(), Box<dyn std::error::Error>> {
    mz_process_collector::register_default_process_collector()?;

    handle_scrapes();

    Ok(())
}

Do not use this in combination with the process feature in the rust-prometheus library, the metrics will clobber each other.

Extra Metrics

In addition to everything provided by rust-prometheus, this library exports:

Structs

ProcessCollector

A collector which exports the current state of process metrics including cpu, memory and file descriptor usage as well as the process start time for the given process id.

Functions

register_default_process_collector

Configure a ProcessCollector to export prometheus metrics in the default registry