Skip to content

Commit cea5bf3

Browse files
committed
fix(metrics): unify partial/full Squads webhook failure into single metric
1 parent fd6ba16 commit cea5bf3

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

jito-bell/src/lib.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,19 +274,24 @@ impl JitoBellHandler {
274274

275275
if errors.is_empty() {
276276
Ok(())
277-
} else if errors.len() < webhook_urls.len() {
278-
self.epoch_metrics
279-
.increment_squads_partial_webhook_failure();
280-
warn!(
281-
"dispatch_slack: partial webhook failure ({}/{} failed) for Squads notification",
282-
errors.len(),
283-
webhook_urls.len()
284-
);
285-
Ok(())
286277
} else {
287-
Err(JitoBellError::Notification(
288-
"All Squads Slack webhooks failed".to_string(),
289-
))
278+
self.epoch_metrics.increment_squads_webhook_failure();
279+
if errors.len() < webhook_urls.len() {
280+
warn!(
281+
"dispatch_slack: partial webhook failure ({}/{} failed) for Squads notification",
282+
errors.len(),
283+
webhook_urls.len()
284+
);
285+
Ok(())
286+
} else {
287+
warn!(
288+
"dispatch_slack: full webhook failure ({} failed) for Squads notification",
289+
webhook_urls.len()
290+
);
291+
Err(JitoBellError::Notification(
292+
"All Squads Slack webhooks failed".to_string(),
293+
))
294+
}
290295
}
291296
}
292297

jito-bell/src/metrics.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ pub(crate) struct SquadsMetrics {
1919
pub(crate) no_config: u64,
2020
/// dispatch_slack called but no webhook URLs resolved from the destination list.
2121
pub(crate) no_webhook: u64,
22-
/// At least one webhook failed while at least one succeeded in the same dispatch.
23-
pub(crate) partial_webhook_failure: u64,
22+
/// A Squads webhook dispatch had at least one delivery failure.
23+
/// This is the single alert surface for both partial and total webhook failure.
24+
pub(crate) webhook_failure: u64,
2425
/// Total individual webhook HTTP/transport errors across all dispatches.
2526
pub(crate) webhook_errors: u64,
2627
}
@@ -116,9 +117,9 @@ impl EpochMetrics {
116117
self.emit_live_metric("jito-bell-squads-no-webhook", 1);
117118
}
118119

119-
pub fn increment_squads_partial_webhook_failure(&mut self) {
120-
self.squads.partial_webhook_failure += 1;
121-
self.emit_live_metric("jito-bell-squads-partial-webhook-failure", 1);
120+
pub fn increment_squads_webhook_failure(&mut self) {
121+
self.squads.webhook_failure += 1;
122+
self.emit_live_metric("jito-bell-squads-webhook-failure", 1);
122123
}
123124

124125
pub fn increment_squads_webhook_errors(&mut self) {

0 commit comments

Comments
 (0)