Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions jito-bell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,24 @@ impl JitoBellHandler {

if errors.is_empty() {
Ok(())
} else if errors.len() < webhook_urls.len() {
self.epoch_metrics
.increment_squads_partial_webhook_failure();
warn!(
"dispatch_slack: partial webhook failure ({}/{} failed) for Squads notification",
errors.len(),
webhook_urls.len()
);
Ok(())
} else {
Err(JitoBellError::Notification(
"All Squads Slack webhooks failed".to_string(),
))
self.epoch_metrics.increment_squads_webhook_failure();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this metric still looks redundant with webhook_errors incremented above for each error in the response?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It's because of two consequential decisions

  • I made the slack-only squads dispatch BUT I kept the AlertConfig type. This type allows for more than one types of alert channels.
  • As such, it is possible to (and at the time i thought maybe we'd want the option) set multiple slack channels for a message. This means that if one of the slack webhooks is down but another is not, 1 error would fire. Not 2. Not 0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice, we'll never hit this path. But i'd rather not silently ignore one of the channels if we set more than one

if errors.len() < webhook_urls.len() {
warn!(
"dispatch_slack: partial webhook failure ({}/{} failed) for Squads notification",
errors.len(),
webhook_urls.len()
);
Ok(())
} else {
warn!(
"dispatch_slack: full webhook failure ({} failed) for Squads notification",
webhook_urls.len()
);
Err(JitoBellError::Notification(
"All Squads Slack webhooks failed".to_string(),
))
}
}
}

Expand Down
11 changes: 6 additions & 5 deletions jito-bell/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ pub(crate) struct SquadsMetrics {
pub(crate) no_config: u64,
/// dispatch_slack called but no webhook URLs resolved from the destination list.
pub(crate) no_webhook: u64,
/// At least one webhook failed while at least one succeeded in the same dispatch.
pub(crate) partial_webhook_failure: u64,
/// A Squads webhook dispatch had at least one delivery failure.
/// This is the single alert surface for both partial and total webhook failure.
pub(crate) webhook_failure: u64,
/// Total individual webhook HTTP/transport errors across all dispatches.
pub(crate) webhook_errors: u64,
}
Expand Down Expand Up @@ -116,9 +117,9 @@ impl EpochMetrics {
self.emit_live_metric("jito-bell-squads-no-webhook", 1);
}

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

pub fn increment_squads_webhook_errors(&mut self) {
Expand Down
Loading