Skip to main content

max / makenotwork

1.2 KB · 45 lines History Blame Raw
1 //! test_duration alert/recovery messages. Domain half of the Alerter split;
2 //! shared dispatch/cooldown plumbing lives in the parent module.
3
4 use tracing::instrument;
5
6 use super::{AlertCategory, AlertMeta, Alerter};
7
8 impl Alerter {
9 #[instrument(skip_all)]
10 pub async fn send_test_duration_drift_alert(
11 &self,
12 target: &str,
13 label: &str,
14 drift_message: &str,
15 ) {
16 let alert_key = format!("test_duration:{target}");
17 let subject = format!("[PoM] {target}: test duration drift detected");
18 let body = format!(
19 "Target: {label} ({target})\n\
20 {drift_message}\n\
21 Instance: {}\n\
22 Time: {}\n\n\
23 - PoM",
24 self.instance_name,
25 chrono::Utc::now().to_rfc3339(),
26 );
27
28 self.fire_failure(
29 &subject,
30 &body,
31 "medium",
32 "pom-test-duration",
33 Some(target),
34 AlertMeta {
35 key: &alert_key,
36 category: AlertCategory::TestDurationDrift,
37 from: None,
38 to: None,
39 error: Some(drift_message),
40 },
41 )
42 .await;
43 }
44 }
45