Crate opentelemetry_system_metrics

Source
Expand description

This is my awesome crate Enabling system metrics from process to be observed using opentelemetry. Current metrics observed are:

  • CPU
  • Memory
  • Disk
  • Network

§Getting started

To use this crate, add the following to your Cargo.toml:

[dependencies]
opentelemetry = "0.29"
opentelemetry-system-metrics = "0.4"
tokio = { version = "1", features = ["full"] }
sysinfo = "0.34"
nvml-wrapper = "0.10"
eyre = { version = "0.6", features = ["tokio"] }
tracing = "0.1"
use opentelemetry::global;
use opentelemetry_system_metrics::init_process_observer;

#[tokio::main]
async fn main() {
    use opentelemetry_system_metrics::init_process_observer_once;
    let meter = global::meter("process-meter");
    let result = init_process_observer_once(meter).await;
}

Functions§

init_process_observer
Record asynchronously information about the current process.
init_process_observer_for_pid
Record asynchronously information about a specific process by its PID.
init_process_observer_once
Record asynchronously information about the current process once.