diff --git a/crates/lib/pager/src/client/pager_builder.rs b/crates/lib/pager/src/client/pager_builder.rs index 4c2ccb8f61..de4ae4fd7f 100644 --- a/crates/lib/pager/src/client/pager_builder.rs +++ b/crates/lib/pager/src/client/pager_builder.rs @@ -59,7 +59,9 @@ impl PagerBuilder { RootlyConfigBuilder { parent: self, api_key, - alert_urgency_id: None, + urgency_id_high: None, + urgency_id_medium: None, + urgency_id_low: None, notification_target_type: None, notification_target_id: None, } @@ -130,15 +132,29 @@ impl PagerBuilder { pub struct RootlyConfigBuilder { parent: PagerBuilder, api_key: RootlyApiKey, - alert_urgency_id: Option, + urgency_id_high: Option, + urgency_id_medium: Option, + urgency_id_low: Option, notification_target_type: Option, notification_target_id: Option, } impl RootlyConfigBuilder { - /// Set the alert urgency ID. - pub fn alert_urgency_id(mut self, id: String) -> Self { - self.alert_urgency_id = Some(id); + /// Set the urgency ID for high-urgency alerts. + pub fn urgency_id_high(mut self, id: String) -> Self { + self.urgency_id_high = Some(id); + self + } + + /// Set the urgency ID for medium-urgency alerts. + pub fn urgency_id_medium(mut self, id: String) -> Self { + self.urgency_id_medium = Some(id); + self + } + + /// Set the urgency ID for low-urgency alerts. + pub fn urgency_id_low(mut self, id: String) -> Self { + self.urgency_id_low = Some(id); self } @@ -153,7 +169,9 @@ impl RootlyConfigBuilder { pub fn done(mut self) -> PagerBuilder { self.parent.client_config = Some(PagerClientConfig::Rootly { api_key: self.api_key, - alert_urgency_id: self.alert_urgency_id, + urgency_id_high: self.urgency_id_high, + urgency_id_medium: self.urgency_id_medium, + urgency_id_low: self.urgency_id_low, notification_target_type: self.notification_target_type, notification_target_id: self.notification_target_id, }); diff --git a/crates/lib/pager/src/client/pager_client.rs b/crates/lib/pager/src/client/pager_client.rs index 99bfa622de..0932aaca34 100644 --- a/crates/lib/pager/src/client/pager_client.rs +++ b/crates/lib/pager/src/client/pager_client.rs @@ -38,8 +38,14 @@ pub enum PagerClientConfig { Rootly { api_key: RootlyApiKey, - /// Alert urgency ID (e.g. "62fde143-..." maps to "High" in our org). - alert_urgency_id: Option, + /// Alert urgency ID for high-urgency alerts. + urgency_id_high: Option, + + /// Alert urgency ID for medium-urgency alerts. + urgency_id_medium: Option, + + /// Alert urgency ID for low-urgency alerts. + urgency_id_low: Option, /// Notification target type (e.g. "User", "EscalationPolicy"). notification_target_type: Option, @@ -93,7 +99,9 @@ impl PagerClient { ) -> Result { let PagerClientConfig::Rootly { api_key, - alert_urgency_id, + urgency_id_high, + urgency_id_medium: _, + urgency_id_low: _, notification_target_type, notification_target_id, } = &self.client_config else { @@ -191,7 +199,7 @@ impl PagerClient { environment_ids: None, external_id: None, external_url: None, - alert_urgency_id: alert_urgency_id.clone(), + alert_urgency_id: urgency_id_high.clone(), notification_target_type: notification_target_type.clone(), notification_target_id: notification_target_id.clone(), labels, diff --git a/crates/service/web/storyteller_web/src/startup/build_pager.rs b/crates/service/web/storyteller_web/src/startup/build_pager.rs index eb071f7952..ab74d15763 100644 --- a/crates/service/web/storyteller_web/src/startup/build_pager.rs +++ b/crates/service/web/storyteller_web/src/startup/build_pager.rs @@ -58,11 +58,10 @@ pub fn build_pager( fn build_rootly_pager(builder: PagerBuilder, api_key: String) -> (Pager, PagerWorker) { let mut rootly_builder = builder - .rootly(RootlyApiKey::new(api_key)); - - if let Some(urgency_id) = easyenv::get_env_string_optional("ROOTLY_ALERT_URGENCY_ID") { - rootly_builder = rootly_builder.alert_urgency_id(urgency_id); - } + .rootly(RootlyApiKey::new(api_key)) + .urgency_id_high(ROOTLY_URGENCY_ID_HIGH.to_string()) + .urgency_id_medium(ROOTLY_URGENCY_ID_MEDIUM.to_string()) + .urgency_id_low(ROOTLY_URGENCY_ID_LOW.to_string()); let target_type = easyenv::get_env_string_optional("ROOTLY_NOTIFICATION_TARGET_TYPE"); let target_id = easyenv::get_env_string_optional("ROOTLY_NOTIFICATION_TARGET_ID");