diff --git a/crates/ptth_file_server_bin/src/main.rs b/crates/ptth_file_server_bin/src/main.rs index bc666ac..e2496a0 100644 --- a/crates/ptth_file_server_bin/src/main.rs +++ b/crates/ptth_file_server_bin/src/main.rs @@ -98,7 +98,7 @@ async fn main () -> Result <(), anyhow::Error> { config_file.name.unwrap_or_else (|| "PTTH File Server".to_string ()) ); - debug! ("{:?}", instance_metrics); + let gauges = metrics::Gauges::new ().await?; let state = Arc::new (State { config: file_server::Config { diff --git a/crates/ptth_server/src/file_server/metrics.rs b/crates/ptth_server/src/file_server/metrics.rs index 5165022..657c39e 100644 --- a/crates/ptth_server/src/file_server/metrics.rs +++ b/crates/ptth_server/src/file_server/metrics.rs @@ -1,4 +1,5 @@ use chrono::{DateTime, Utc}; +use tracing::debug; use ulid::Ulid; fn serialize_ulid (t: &Ulid, s: S) @@ -46,9 +47,13 @@ impl Gauges { let mem = our_process.memory ().await?; let rss_mib = mem.rss ().get:: (); - Ok (Gauges { + let x = Gauges { rss_mib, - }) + }; + + debug! ("metric gauges: {:?}", x); + + Ok (x) } } @@ -74,13 +79,17 @@ impl Startup { #[must_use] pub fn new (server_name: String) -> Self { - Self { + let x = Self { machine_id: get_machine_id (), git_version: None, server_name, instance_id: ulid::Ulid::new (), startup_utc: Utc::now (), - } + }; + + debug! ("metrics at startup: {:?}", x); + + x } } diff --git a/crates/ptth_server/src/lib.rs b/crates/ptth_server/src/lib.rs index 809edb8..d8f222b 100644 --- a/crates/ptth_server/src/lib.rs +++ b/crates/ptth_server/src/lib.rs @@ -215,9 +215,7 @@ pub async fn run_server ( config: Config { relay_url: config_file.relay_url, }, - gauges: RwLock::new (file_server::metrics::Gauges { - rss_mib: 7, - }), + gauges: RwLock::new (file_server::metrics::Gauges::new ().await?), client, });