🚧 wip: add placeholder for gauges

main
_ 2020-12-20 17:41:00 +00:00
parent b54be58abc
commit d052f42507
2 changed files with 13 additions and 1 deletions

View File

@ -31,6 +31,11 @@ pub struct PerInstance {
pub startup_utc: DateTime <Utc>, pub startup_utc: DateTime <Utc>,
} }
#[derive (Debug, serde::Serialize)]
pub struct Gauges {
pub rss_mib: u64,
}
fn get_machine_id () -> Option <String> { fn get_machine_id () -> Option <String> {
use std::{ use std::{
fs::File, fs::File,

View File

@ -18,7 +18,10 @@ use handlebars::Handlebars;
use reqwest::Client; use reqwest::Client;
use serde::Deserialize; use serde::Deserialize;
use tokio::{ use tokio::{
sync::oneshot, sync::{
oneshot,
RwLock,
},
time::delay_for, time::delay_for,
}; };
@ -52,6 +55,7 @@ struct ServerState {
config: Config, config: Config,
handlebars: Handlebars <'static>, handlebars: Handlebars <'static>,
instance_metrics: file_server::metrics::PerInstance, instance_metrics: file_server::metrics::PerInstance,
gauges: RwLock <file_server::metrics::Gauges>,
client: Client, client: Client,
hidden_path: Option <PathBuf>, hidden_path: Option <PathBuf>,
} }
@ -210,6 +214,9 @@ pub async fn run_server (
}, },
handlebars, handlebars,
instance_metrics, instance_metrics,
gauges: RwLock::new (file_server::metrics::Gauges {
rss_mib: 7,
}),
client, client,
hidden_path, hidden_path,
}); });