update: print RSS in MiB at startup

main
_ 2020-12-20 18:58:14 +00:00
parent bc361fa876
commit 64ac4baaa8
3 changed files with 15 additions and 8 deletions

View File

@ -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 {

View File

@ -1,4 +1,5 @@
use chrono::{DateTime, Utc};
use tracing::debug;
use ulid::Ulid;
fn serialize_ulid <S: serde::Serializer> (t: &Ulid, s: S)
@ -46,9 +47,13 @@ impl Gauges {
let mem = our_process.memory ().await?;
let rss_mib = mem.rss ().get::<mebibyte> ();
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
}
}

View File

@ -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,
});