fix: docs placement
This commit is contained in:
@@ -23,9 +23,12 @@ async fn main() -> Result<()> {
|
||||
.unwrap_or_else(|_| "http://localhost:3000".into());
|
||||
let monitor_token = env::var("MONITOR_TOKEN")
|
||||
.expect("MONITOR_TOKEN must be set");
|
||||
let region = env::var("REGION").unwrap_or_default();
|
||||
// Region label this runner reports on every ping. "default" means the operator
|
||||
// didn't pin this runner to a named region — it's still a meaningful label so
|
||||
// alerts say where they came from instead of being blank.
|
||||
let region = env::var("REGION").ok().filter(|s| !s.is_empty()).unwrap_or_else(|| "default".to_string());
|
||||
|
||||
info!("PingQL monitor starting, coordinator: {coordinator_url}, region: {}", if region.is_empty() { "all" } else { ®ion });
|
||||
info!("PingQL monitor starting, coordinator: {coordinator_url}, region: {region}");
|
||||
|
||||
let client = reqwest::Client::builder()
|
||||
.user_agent("PingQL-Monitor/0.1")
|
||||
|
||||
@@ -25,11 +25,7 @@ pub async fn fetch_and_run(
|
||||
region: &str,
|
||||
in_flight: &Arc<Mutex<HashSet<String>>>,
|
||||
) -> Result<usize> {
|
||||
let url = if region.is_empty() {
|
||||
format!("{coordinator_url}/internal/due?lookahead_ms=2000")
|
||||
} else {
|
||||
format!("{coordinator_url}/internal/due?region={}&lookahead_ms=2000", region)
|
||||
};
|
||||
let url = format!("{coordinator_url}/internal/due?region={region}&lookahead_ms=2000");
|
||||
let monitors: Vec<Monitor> = client
|
||||
.get(&url)
|
||||
.header("x-monitor-token", token)
|
||||
@@ -103,7 +99,7 @@ pub async fn fetch_and_run(
|
||||
error: Some(format!("timed out after {}ms", timeout_ms)),
|
||||
cert_expiry_days: None,
|
||||
meta: None,
|
||||
region: if region_owned.is_empty() { None } else { Some(region_owned.to_string()) },
|
||||
region: Some(region_owned.to_string()),
|
||||
run_id: Some(run_id_owned.clone()),
|
||||
},
|
||||
};
|
||||
@@ -197,7 +193,7 @@ async fn run_check(client: &reqwest::Client, monitor: &Monitor, scheduled_at: Op
|
||||
error: Some(e.clone()),
|
||||
cert_expiry_days: None,
|
||||
meta: None,
|
||||
region: if region.is_empty() { None } else { Some(region.to_string()) },
|
||||
region: Some(region.to_string()),
|
||||
run_id: Some(run_id.to_string()),
|
||||
}
|
||||
},
|
||||
@@ -262,7 +258,7 @@ async fn run_check(client: &reqwest::Client, monitor: &Monitor, scheduled_at: Op
|
||||
error: query_error,
|
||||
cert_expiry_days,
|
||||
meta: Some(meta),
|
||||
region: if region.is_empty() { None } else { Some(region.to_string()) },
|
||||
region: Some(region.to_string()),
|
||||
run_id: Some(run_id.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user