rename: checks → pings throughout (DB, API, UI, Rust)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::query::{self, Response};
|
||||
use crate::types::{CheckResult, Monitor};
|
||||
use crate::types::{PingResult, Monitor};
|
||||
use anyhow::Result;
|
||||
use serde_json::json;
|
||||
use std::collections::HashMap;
|
||||
@@ -42,7 +42,7 @@ pub async fn fetch_and_run(
|
||||
Ok(n)
|
||||
}
|
||||
|
||||
async fn run_check(client: &reqwest::Client, monitor: &Monitor) -> CheckResult {
|
||||
async fn run_check(client: &reqwest::Client, monitor: &Monitor) -> PingResult {
|
||||
let start = Instant::now();
|
||||
|
||||
// Check cert expiry for HTTPS URLs
|
||||
@@ -56,7 +56,7 @@ async fn run_check(client: &reqwest::Client, monitor: &Monitor) -> CheckResult {
|
||||
let latency_ms = start.elapsed().as_millis() as u64;
|
||||
|
||||
match result {
|
||||
Err(e) => CheckResult {
|
||||
Err(e) => PingResult {
|
||||
monitor_id: monitor.id.clone(),
|
||||
status_code: None,
|
||||
latency_ms: Some(latency_ms),
|
||||
@@ -102,7 +102,7 @@ async fn run_check(client: &reqwest::Client, monitor: &Monitor) -> CheckResult {
|
||||
|
||||
debug!("{} → {status} {latency_ms}ms up={up}", monitor.url);
|
||||
|
||||
CheckResult {
|
||||
PingResult {
|
||||
monitor_id: monitor.id.clone(),
|
||||
status_code: Some(status),
|
||||
latency_ms: Some(latency_ms),
|
||||
@@ -165,7 +165,7 @@ async fn post_result(
|
||||
client: &reqwest::Client,
|
||||
coordinator_url: &str,
|
||||
token: &str,
|
||||
result: CheckResult,
|
||||
result: PingResult,
|
||||
) -> Result<()> {
|
||||
client
|
||||
.post(format!("{coordinator_url}/internal/ingest"))
|
||||
|
||||
@@ -10,7 +10,7 @@ pub struct Monitor {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct CheckResult {
|
||||
pub struct PingResult {
|
||||
pub monitor_id: String,
|
||||
pub status_code: Option<u16>,
|
||||
pub latency_ms: Option<u64>,
|
||||
|
||||
Reference in New Issue
Block a user