From 522678e394a132d054c9d2a4912054f1f2aa2ee0 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 24 Jan 2023 09:38:12 -0800 Subject: [PATCH] don't send pagerduty alerts for websocket panics --- TODO.md | 2 + web3_proxy/src/bin/web3_proxy_cli/main.rs | 46 ++++++++++++----------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/TODO.md b/TODO.md index 15ba2239..986c4816 100644 --- a/TODO.md +++ b/TODO.md @@ -319,6 +319,8 @@ These are not yet ordered. There might be duplicates. We might not actually need - this will let us easily wait for a new head or a new synced connection - [x] broadcast transactions to more servers - [x] send sentryd errors to pagerduty +- [x] improve handling of unknown methods +- [x] don't send pagerduty alerts for websocket panics - [-] proxy mode for benchmarking all backends - [-] proxy mode for sending to multiple backends - [-] let users choose a % of reverts to log (or maybe x/second). someone like curve logging all reverts will be a BIG database very quickly diff --git a/web3_proxy/src/bin/web3_proxy_cli/main.rs b/web3_proxy/src/bin/web3_proxy_cli/main.rs index cea65a8f..f658b46e 100644 --- a/web3_proxy/src/bin/web3_proxy_cli/main.rs +++ b/web3_proxy/src/bin/web3_proxy_cli/main.rs @@ -231,30 +231,34 @@ fn main() -> anyhow::Result<()> { let hostname = gethostname().into_string().unwrap_or("unknown".to_string()); let panic_msg = format!("{} {:?}", x, x); - error!("sending panic to pagerduty: {}", panic_msg); + if panic_msg.starts_with("panicked at 'WS Server panic") { + info!("Underlying library {}", panic_msg); + } else { + error!("sending panic to pagerduty: {}", panic_msg); - let payload = AlertTriggerPayload { - severity: pagerduty_rs::types::Severity::Error, - summary: panic_msg.clone(), - source: hostname, - timestamp: None, - component: None, - group: Some("web3-proxy".to_string()), - class: Some("panic".to_string()), - custom_details: None::<()>, - }; + let payload = AlertTriggerPayload { + severity: pagerduty_rs::types::Severity::Error, + summary: panic_msg.clone(), + source: hostname, + timestamp: None, + component: None, + group: Some("web3-proxy".to_string()), + class: Some("panic".to_string()), + custom_details: None::<()>, + }; - let event = Event::AlertTrigger(AlertTrigger { - payload, - dedup_key: None, - images: None, - links: None, - client: Some(client.clone()), - client_url: client_url.clone(), - }); + let event = Event::AlertTrigger(AlertTrigger { + payload, + dedup_key: None, + images: None, + links: None, + client: Some(client.clone()), + client_url: client_url.clone(), + }); - if let Err(err) = pagerduty_sync.event(event) { - error!("Failed sending panic to pagerduty: {}", err); + if let Err(err) = pagerduty_sync.event(event) { + error!("Failed sending panic to pagerduty: {}", err); + } } })); }