From d052f42507b44299b40fe254f5d13cc1b5638d83 Mon Sep 17 00:00:00 2001 From: _ <> Date: Sun, 20 Dec 2020 17:41:00 +0000 Subject: [PATCH] :construction: wip: add placeholder for gauges --- crates/ptth_server/src/file_server/metrics.rs | 5 +++++ crates/ptth_server/src/lib.rs | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/ptth_server/src/file_server/metrics.rs b/crates/ptth_server/src/file_server/metrics.rs index e760843..9db8d51 100644 --- a/crates/ptth_server/src/file_server/metrics.rs +++ b/crates/ptth_server/src/file_server/metrics.rs @@ -31,6 +31,11 @@ pub struct PerInstance { pub startup_utc: DateTime , } +#[derive (Debug, serde::Serialize)] +pub struct Gauges { + pub rss_mib: u64, +} + fn get_machine_id () -> Option { use std::{ fs::File, diff --git a/crates/ptth_server/src/lib.rs b/crates/ptth_server/src/lib.rs index a5a8173..0bf214e 100644 --- a/crates/ptth_server/src/lib.rs +++ b/crates/ptth_server/src/lib.rs @@ -18,7 +18,10 @@ use handlebars::Handlebars; use reqwest::Client; use serde::Deserialize; use tokio::{ - sync::oneshot, + sync::{ + oneshot, + RwLock, + }, time::delay_for, }; @@ -52,6 +55,7 @@ struct ServerState { config: Config, handlebars: Handlebars <'static>, instance_metrics: file_server::metrics::PerInstance, + gauges: RwLock , client: Client, hidden_path: Option , } @@ -210,6 +214,9 @@ pub async fn run_server ( }, handlebars, instance_metrics, + gauges: RwLock::new (file_server::metrics::Gauges { + rss_mib: 7, + }), client, hidden_path, });