more context on everything
This commit is contained in:
parent
0c879c5613
commit
e85965ec12
@ -53,11 +53,13 @@ pub async fn main(
|
|||||||
.post(&rpc)
|
.post(&rpc)
|
||||||
.json(&block_by_number_request)
|
.json(&block_by_number_request)
|
||||||
.send()
|
.send()
|
||||||
.await?
|
.await
|
||||||
|
.context(format!("error fetching block from {}", rpc))?
|
||||||
.json::<JsonRpcResponse<Block<TxHash>>>()
|
.json::<JsonRpcResponse<Block<TxHash>>>()
|
||||||
.await?
|
.await
|
||||||
|
.context(format!("error parsing block from {}", rpc))?
|
||||||
.result
|
.result
|
||||||
.context(format!("error fetching block from {}", rpc))?;
|
.context(format!("no block from {}", rpc))?;
|
||||||
|
|
||||||
// check the parent because b and c might not be as fast as a
|
// check the parent because b and c might not be as fast as a
|
||||||
let parent_hash = a.parent_hash;
|
let parent_hash = a.parent_hash;
|
||||||
|
@ -95,7 +95,7 @@ impl SentrydSubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while let Some(err) = error_receiver.recv().await {
|
while let Some(err) = error_receiver.recv().await {
|
||||||
log::log!(err.level, "check failed: {:?}", err);
|
log::log!(err.level, "check failed: {:#?}", err);
|
||||||
|
|
||||||
if matches!(err.level, log::Level::Error) {
|
if matches!(err.level, log::Level::Error) {
|
||||||
let alert = pagerduty_alert(
|
let alert = pagerduty_alert(
|
||||||
@ -108,20 +108,20 @@ impl SentrydSubCommand {
|
|||||||
Some("web3-proxy-sentry".to_string()),
|
Some("web3-proxy-sentry".to_string()),
|
||||||
pagerduty_rs::types::Severity::Error,
|
pagerduty_rs::types::Severity::Error,
|
||||||
None,
|
None,
|
||||||
format!("{}", err.anyhow),
|
format!("{:#?}", err.anyhow),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(pagerduty_async) = pagerduty_async.as_ref() {
|
if let Some(pagerduty_async) = pagerduty_async.as_ref() {
|
||||||
info!(
|
info!(
|
||||||
"sending to pagerduty: {}",
|
"sending to pagerduty: {:#}",
|
||||||
serde_json::to_string_pretty(&alert)?
|
serde_json::to_string_pretty(&alert)?
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Err(err) =
|
if let Err(err) =
|
||||||
pagerduty_async.event(Event::AlertTrigger(alert)).await
|
pagerduty_async.event(Event::AlertTrigger(alert)).await
|
||||||
{
|
{
|
||||||
error!("Failed sending to pagerduty: {}", err);
|
error!("Failed sending to pagerduty: {:#?}", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ pub fn pagerduty_alert<T: Serialize>(
|
|||||||
source.unwrap_or_else(|| gethostname().into_string().unwrap_or("unknown".to_string()));
|
source.unwrap_or_else(|| gethostname().into_string().unwrap_or("unknown".to_string()));
|
||||||
|
|
||||||
let mut s = DefaultHasher::new();
|
let mut s = DefaultHasher::new();
|
||||||
|
// TODO: include severity here?
|
||||||
summary.hash(&mut s);
|
summary.hash(&mut s);
|
||||||
client.hash(&mut s);
|
client.hash(&mut s);
|
||||||
client_url.hash(&mut s);
|
client_url.hash(&mut s);
|
||||||
|
Loading…
Reference in New Issue
Block a user