Crate mz_process_collector[][src]

Expand description

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>> {
    let registry = MetricsRegistry::new();
    mz_process_collector::register_default_process_collector(&registry);

    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:

  • Per-thread name cpu time: process_thread_cpu_seconds_total{thread_name}
  • Count of threads with the same name: process_thread_count{thread_name}

Modules

Monitor a process.

Structs

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

Configure a ProcessCollector to export prometheus metrics in the default registry