LCOV - code coverage report
Current view: top level - libs/vm_monitor/src/bin - monitor.rs (source / functions) Coverage Total Hit
Test: f081ec316c96fa98335efd15ef501745aa4f015d.info Lines: 0.0 % 19 0
Test Date: 2024-06-25 15:11:17 Functions: 0.0 % 2 0

            Line data    Source code
       1              : // We expose a standalone binary _and_ start the monitor in `compute_ctl` so that
       2              : // we can test the monitor as part of the entire autoscaling system in
       3              : // neondatabase/autoscaling.
       4              : //
       5              : // The monitor was previously started by vm-builder, and for testing purposes,
       6              : // we can mimic that setup with this binary.
       7              : 
       8              : #[cfg(target_os = "linux")]
       9              : #[tokio::main]
      10            0 : async fn main() -> anyhow::Result<()> {
      11            0 :     use clap::Parser;
      12            0 :     use tokio_util::sync::CancellationToken;
      13            0 :     use tracing_subscriber::EnvFilter;
      14            0 :     use vm_monitor::Args;
      15            0 : 
      16            0 :     let subscriber = tracing_subscriber::fmt::Subscriber::builder()
      17            0 :         .json()
      18            0 :         .with_file(true)
      19            0 :         .with_line_number(true)
      20            0 :         .with_span_list(true)
      21            0 :         .with_env_filter(EnvFilter::from_default_env())
      22            0 :         .finish();
      23            0 :     tracing::subscriber::set_global_default(subscriber)?;
      24            0 : 
      25            0 :     let args: &'static Args = Box::leak(Box::new(Args::parse()));
      26            0 :     let token = CancellationToken::new();
      27            0 :     vm_monitor::start(args, token).await
      28            0 : }
      29              : 
      30              : #[cfg(not(target_os = "linux"))]
      31              : fn main() {
      32              :     panic!("the monitor requires cgroups, which are only available on linux")
      33              : }
        

Generated by: LCOV version 2.1-beta