parent
44105e1f80
commit
6237e5eb50
1 changed files with 0 additions and 42 deletions
|
@ -281,48 +281,6 @@ pub async fn post_hang(
|
||||||
backtrace = %backtrace,
|
backtrace = %backtrace,
|
||||||
"hang report");
|
"hang report");
|
||||||
|
|
||||||
if let Some(slack_panics_webhook) = app.config.slack_panics_webhook.clone() {
|
|
||||||
let payload = slack::WebhookBody::new(|w| {
|
|
||||||
w.add_section(|s| s.text(slack::Text::markdown("Possible Hang".to_string())))
|
|
||||||
.add_section(|s| {
|
|
||||||
s.add_field(slack::Text::markdown(format!(
|
|
||||||
"*Version:*\n {} ",
|
|
||||||
report.app_version.unwrap_or_default()
|
|
||||||
)))
|
|
||||||
.add_field({
|
|
||||||
let hostname = app.config.blob_store_url.clone().unwrap_or_default();
|
|
||||||
let hostname = hostname.strip_prefix("https://").unwrap_or_else(|| {
|
|
||||||
hostname.strip_prefix("http://").unwrap_or_default()
|
|
||||||
});
|
|
||||||
|
|
||||||
slack::Text::markdown(format!(
|
|
||||||
"*Incident:*\n<https://{}.{}/{}.hang.json|{}…>",
|
|
||||||
CRASH_REPORTS_BUCKET,
|
|
||||||
hostname,
|
|
||||||
incident_id,
|
|
||||||
incident_id.chars().take(8).collect::<String>(),
|
|
||||||
))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.add_rich_text(|r| r.add_preformatted(|p| p.add_text(backtrace)))
|
|
||||||
});
|
|
||||||
let payload_json = serde_json::to_string(&payload).map_err(|err| {
|
|
||||||
log::error!("Failed to serialize payload to JSON: {err}");
|
|
||||||
Error::Internal(anyhow!(err))
|
|
||||||
})?;
|
|
||||||
|
|
||||||
reqwest::Client::new()
|
|
||||||
.post(slack_panics_webhook)
|
|
||||||
.header("Content-Type", "application/json")
|
|
||||||
.body(payload_json)
|
|
||||||
.send()
|
|
||||||
.await
|
|
||||||
.map_err(|err| {
|
|
||||||
log::error!("Failed to send payload to Slack: {err}");
|
|
||||||
Error::Internal(anyhow!(err))
|
|
||||||
})?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue