feat: customizable threshold too
This commit is contained in:
parent
ec77fe6a99
commit
fb1afda695
2 changed files with 6 additions and 2 deletions
|
@ -87,7 +87,7 @@
|
||||||
function cell(timestamp, rtt) {
|
function cell(timestamp, rtt) {
|
||||||
let d = new Date(timestamp * 1000);
|
let d = new Date(timestamp * 1000);
|
||||||
let warning = "";
|
let warning = "";
|
||||||
if (rtt !== null && rtt >= 1000) {
|
if (rtt !== null && rtt >= %%THRESHOLD%%) {
|
||||||
warning = " warning";
|
warning = " warning";
|
||||||
}
|
}
|
||||||
if (rtt === null) {
|
if (rtt === null) {
|
||||||
|
|
|
@ -26,6 +26,9 @@ struct Config {
|
||||||
/// service description shown in web page
|
/// service description shown in web page
|
||||||
description: Option<String>,
|
description: Option<String>,
|
||||||
|
|
||||||
|
/// requests taking longer than this limit (in ms) will be marked as "slow" in FE
|
||||||
|
threshold: Option<u64>,
|
||||||
|
|
||||||
/// how many samples of history to keep
|
/// how many samples of history to keep
|
||||||
//history: usize,
|
//history: usize,
|
||||||
|
|
||||||
|
@ -89,7 +92,8 @@ async fn entry(cli: Cli, config: Config, db: Database) -> Result<(), Box<dyn std
|
||||||
}
|
}
|
||||||
|
|
||||||
let index = include_str!("../index.html")
|
let index = include_str!("../index.html")
|
||||||
.replacen("%%DESCRIPTION%%", config.description.as_deref().unwrap_or("keeping track of your infra's up status"), 1);
|
.replacen("%%DESCRIPTION%%", config.description.as_deref().unwrap_or("keeping track of your infra's up status"), 1)
|
||||||
|
.replacen("%%THRESHOLD%%", &config.threshold.unwrap_or(1000).to_string(), 1);
|
||||||
|
|
||||||
// build our application with a single route
|
// build our application with a single route
|
||||||
let app = axum::Router::new()
|
let app = axum::Router::new()
|
||||||
|
|
Loading…
Reference in a new issue