Skip to content

Commit 1b62c0e

Browse files
apollo_dashboard: fix additional conflicting alert names
1 parent 3f85fd0 commit 1b62c0e

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

crates/apollo_dashboard/resources/dev_grafana_alerts.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@
898898
},
899899
{
900900
"name": "batched_transactions_stuck",
901-
"title": "Batched transactions stuck",
901+
"title": "Batched Transactions Stuck",
902902
"ruleGroup": "batcher",
903903
"expr": "changes(batcher_batched_transactions{cluster=~\"$cluster\", namespace=~\"$namespace\"}[$$$batched_transactions_stuck-sampling_window_secs-expression$$$s])",
904904
"conditions": [
@@ -926,7 +926,7 @@
926926
},
927927
{
928928
"name": "batched_transactions_stuck_long_time",
929-
"title": "Batched transactions stuck",
929+
"title": "Batched Transactions Stuck Long Time",
930930
"ruleGroup": "batcher",
931931
"expr": "changes(batcher_batched_transactions{cluster=~\"$cluster\", namespace=~\"$namespace\"}[$$$batched_transactions_stuck_long_time-sampling_window_secs-expression$$$s])",
932932
"conditions": [
@@ -1010,7 +1010,7 @@
10101010
},
10111011
{
10121012
"name": "consensus_block_number_stuck",
1013-
"title": "Consensus block number stuck",
1013+
"title": "Consensus Block Number Stuck",
10141014
"ruleGroup": "consensus",
10151015
"expr": "sum(increase(consensus_block_number{cluster=~\"$cluster\", namespace=~\"$namespace\"}[$$$consensus_block_number_stuck-sampling_window_secs-expression$$$s])) or vector(0)",
10161016
"conditions": [
@@ -1038,7 +1038,7 @@
10381038
},
10391039
{
10401040
"name": "consensus_block_number_stuck_long_time",
1041-
"title": "Consensus block number stuck",
1041+
"title": "Consensus Block Number Stuck Long Time",
10421042
"ruleGroup": "consensus",
10431043
"expr": "sum(increase(consensus_block_number{cluster=~\"$cluster\", namespace=~\"$namespace\"}[$$$consensus_block_number_stuck_long_time-sampling_window_secs-expression$$$s])) or vector(0)",
10441044
"conditions": [
@@ -1066,7 +1066,7 @@
10661066
},
10671067
{
10681068
"name": "consensus_p2p_not_enough_peers_for_quorum",
1069-
"title": "Consensus p2p not enough peers for quorum",
1069+
"title": "Consensus P2P Not Enough Peers For Quorum",
10701070
"ruleGroup": "consensus",
10711071
"expr": "max_over_time(apollo_consensus_num_connected_peers{cluster=~\"$cluster\", namespace=~\"$namespace\"}[120s])",
10721072
"conditions": [
@@ -1094,7 +1094,7 @@
10941094
},
10951095
{
10961096
"name": "consensus_p2p_not_enough_peers_for_quorum_long_time",
1097-
"title": "Consensus p2p not enough peers for quorum",
1097+
"title": "Consensus P2P Not Enough Peers For Quorum Long Time",
10981098
"ruleGroup": "consensus",
10991099
"expr": "max_over_time(apollo_consensus_num_connected_peers{cluster=~\"$cluster\", namespace=~\"$namespace\"}[1800s])",
11001100
"conditions": [

crates/apollo_dashboard/src/alert_scenarios/block_production_halt.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,19 @@ use crate::alerts::{
2626
};
2727

2828
/// Block number is stuck for more than duration minutes.
29-
fn get_consensus_block_number_stuck(
30-
alert_name: &'static str,
31-
alert_severity: AlertSeverity,
32-
) -> Alert {
29+
fn get_consensus_block_number_stuck(title: &'static str, alert_severity: AlertSeverity) -> Alert {
30+
let name = title.to_lowercase().replace(' ', "_");
3331
let expr_template_string = format!(
3432
"sum(increase({}[{{}}s])) or vector(0)",
3533
CONSENSUS_BLOCK_NUMBER.get_name_with_filter()
3634
);
3735
Alert::new(
38-
alert_name,
39-
"Consensus block number stuck",
36+
&name,
37+
title,
4038
AlertGroup::Consensus,
4139
ExpressionOrExpressionWithPlaceholder::Placeholder(
4240
Template::new(expr_template_string),
43-
vec![format_sampling_window(alert_name)],
41+
vec![format_sampling_window(&name)],
4442
),
4543
vec![AlertCondition::new(AlertComparisonOp::LessThan, 1.0, AlertLogicalOp::And)],
4644
PENDING_DURATION_DEFAULT,
@@ -52,48 +50,49 @@ fn get_consensus_block_number_stuck(
5250

5351
pub(crate) fn get_consensus_block_number_stuck_vec() -> Vec<Alert> {
5452
vec![
55-
get_consensus_block_number_stuck("consensus_block_number_stuck", AlertSeverity::Sos),
53+
get_consensus_block_number_stuck("Consensus Block Number Stuck", AlertSeverity::Sos),
5654
get_consensus_block_number_stuck(
57-
"consensus_block_number_stuck_long_time",
55+
"Consensus Block Number Stuck Long Time",
5856
AlertSeverity::Regular,
5957
),
6058
]
6159
}
6260

63-
fn get_batched_transactions_stuck(alert_name: &'static str) -> Alert {
61+
fn get_batched_transactions_stuck(title: &'static str) -> Alert {
62+
let name = title.to_lowercase().replace(' ', "_");
6463
let expr_template_string =
6564
format!("changes({}[{{}}s])", BATCHED_TRANSACTIONS.get_name_with_filter());
6665
Alert::new(
67-
alert_name,
68-
"Batched transactions stuck",
66+
&name,
67+
title,
6968
AlertGroup::Batcher,
7069
ExpressionOrExpressionWithPlaceholder::Placeholder(
7170
Template::new(expr_template_string),
72-
vec![format_sampling_window(alert_name)],
71+
vec![format_sampling_window(&name)],
7372
),
7473
vec![AlertCondition::new(AlertComparisonOp::LessThan, 1.0, AlertLogicalOp::And)],
7574
PENDING_DURATION_DEFAULT,
7675
EVALUATION_INTERVAL_SEC_DEFAULT,
77-
SeverityValueOrPlaceholder::Placeholder(alert_name.to_string()),
76+
SeverityValueOrPlaceholder::Placeholder(name.clone()),
7877
ObserverApplicability::NotApplicable,
7978
)
8079
}
8180

8281
pub(crate) fn get_batched_transactions_stuck_vec() -> Vec<Alert> {
8382
vec![
84-
get_batched_transactions_stuck("batched_transactions_stuck"),
85-
get_batched_transactions_stuck("batched_transactions_stuck_long_time"),
83+
get_batched_transactions_stuck("Batched Transactions Stuck"),
84+
get_batched_transactions_stuck("Batched Transactions Stuck Long Time"),
8685
]
8786
}
8887

8988
fn get_consensus_p2p_not_enough_peers_for_quorum(
90-
alert_name: &'static str,
89+
title: &'static str,
9190
duration: Duration,
9291
alert_severity: AlertSeverity,
9392
) -> Alert {
9493
Alert::new(
95-
alert_name,
96-
"Consensus p2p not enough peers for quorum",
94+
title.to_lowercase().replace(' ', "_"),
95+
title,
9796
AlertGroup::Consensus,
9897
format!(
9998
"max_over_time({}[{}s])",
@@ -117,12 +116,12 @@ fn get_consensus_p2p_not_enough_peers_for_quorum(
117116
pub(crate) fn get_consensus_p2p_not_enough_peers_for_quorum_vec() -> Vec<Alert> {
118117
vec![
119118
get_consensus_p2p_not_enough_peers_for_quorum(
120-
"consensus_p2p_not_enough_peers_for_quorum",
119+
"Consensus P2P Not Enough Peers For Quorum",
121120
Duration::from_secs(2 * SECS_IN_MIN),
122121
AlertSeverity::Sos,
123122
),
124123
get_consensus_p2p_not_enough_peers_for_quorum(
125-
"consensus_p2p_not_enough_peers_for_quorum_long_time",
124+
"Consensus P2P Not Enough Peers For Quorum Long Time",
126125
Duration::from_secs(30 * SECS_IN_MIN),
127126
AlertSeverity::Regular,
128127
),

0 commit comments

Comments
 (0)