Report build SHA to Slack for Zed Nightly panics (#34665)
There can be a bunch of nightlies with the same version number and it's helpful to know exactly which one reported a panic. Release Notes: - N/A
This commit is contained in:
parent
0c88189aab
commit
237ce5c8e8
1 changed files with 43 additions and 38 deletions
|
@ -389,53 +389,58 @@ pub async fn post_panic(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let backtrace = if panic.backtrace.len() > 25 {
|
|
||||||
let total = panic.backtrace.len();
|
|
||||||
format!(
|
|
||||||
"{}\n and {} more",
|
|
||||||
panic
|
|
||||||
.backtrace
|
|
||||||
.iter()
|
|
||||||
.take(20)
|
|
||||||
.cloned()
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join("\n"),
|
|
||||||
total - 20
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
panic.backtrace.join("\n")
|
|
||||||
};
|
|
||||||
|
|
||||||
if !report_to_slack(&panic) {
|
if !report_to_slack(&panic) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let backtrace_with_summary = panic.payload + "\n" + &backtrace;
|
|
||||||
|
|
||||||
if let Some(slack_panics_webhook) = app.config.slack_panics_webhook.clone() {
|
if let Some(slack_panics_webhook) = app.config.slack_panics_webhook.clone() {
|
||||||
|
let backtrace = if panic.backtrace.len() > 25 {
|
||||||
|
let total = panic.backtrace.len();
|
||||||
|
format!(
|
||||||
|
"{}\n and {} more",
|
||||||
|
panic
|
||||||
|
.backtrace
|
||||||
|
.iter()
|
||||||
|
.take(20)
|
||||||
|
.cloned()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("\n"),
|
||||||
|
total - 20
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
panic.backtrace.join("\n")
|
||||||
|
};
|
||||||
|
let backtrace_with_summary = panic.payload + "\n" + &backtrace;
|
||||||
|
|
||||||
|
let version = if panic.release_channel == "nightly"
|
||||||
|
&& !panic.app_version.contains("remote-server")
|
||||||
|
&& let Some(sha) = panic.app_commit_sha
|
||||||
|
{
|
||||||
|
format!("Zed Nightly {}", sha.chars().take(7).collect::<String>())
|
||||||
|
} else {
|
||||||
|
panic.app_version
|
||||||
|
};
|
||||||
|
|
||||||
let payload = slack::WebhookBody::new(|w| {
|
let payload = slack::WebhookBody::new(|w| {
|
||||||
w.add_section(|s| s.text(slack::Text::markdown("Panic request".to_string())))
|
w.add_section(|s| s.text(slack::Text::markdown("Panic request".to_string())))
|
||||||
.add_section(|s| {
|
.add_section(|s| {
|
||||||
s.add_field(slack::Text::markdown(format!(
|
s.add_field(slack::Text::markdown(format!("*Version:*\n {version} ",)))
|
||||||
"*Version:*\n {} ",
|
.add_field({
|
||||||
panic.app_version
|
let hostname = app.config.blob_store_url.clone().unwrap_or_default();
|
||||||
)))
|
let hostname = hostname.strip_prefix("https://").unwrap_or_else(|| {
|
||||||
.add_field({
|
hostname.strip_prefix("http://").unwrap_or_default()
|
||||||
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!(
|
slack::Text::markdown(format!(
|
||||||
"*{} {}:*\n<https://{}.{}/{}.json|{}…>",
|
"*{} {}:*\n<https://{}.{}/{}.json|{}…>",
|
||||||
panic.os_name,
|
panic.os_name,
|
||||||
panic.os_version.unwrap_or_default(),
|
panic.os_version.unwrap_or_default(),
|
||||||
CRASH_REPORTS_BUCKET,
|
CRASH_REPORTS_BUCKET,
|
||||||
hostname,
|
hostname,
|
||||||
incident_id,
|
incident_id,
|
||||||
incident_id.chars().take(8).collect::<String>(),
|
incident_id.chars().take(8).collect::<String>(),
|
||||||
))
|
))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.add_rich_text(|r| r.add_preformatted(|p| p.add_text(backtrace_with_summary)))
|
.add_rich_text(|r| r.add_preformatted(|p| p.add_text(backtrace_with_summary)))
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue