Upload telemetry event on crashes (#36695)
This will let us track crashes-per-launch using the new minidump-based crash reporting. Release Notes: - N/A Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
parent
ca0a20f3d5
commit
e42a0da5ce
1 changed files with 22 additions and 2 deletions
|
@ -251,6 +251,7 @@ pub fn init(
|
||||||
endpoint,
|
endpoint,
|
||||||
minidump_contents,
|
minidump_contents,
|
||||||
&metadata,
|
&metadata,
|
||||||
|
installation_id.clone(),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.log_err();
|
.log_err();
|
||||||
|
@ -478,7 +479,9 @@ fn upload_panics_and_crashes(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cx.background_spawn(async move {
|
cx.background_spawn(async move {
|
||||||
upload_previous_minidumps(http.clone()).await.warn_on_err();
|
upload_previous_minidumps(http.clone(), installation_id.clone())
|
||||||
|
.await
|
||||||
|
.warn_on_err();
|
||||||
let most_recent_panic = upload_previous_panics(http.clone(), &panic_report_url)
|
let most_recent_panic = upload_previous_panics(http.clone(), &panic_report_url)
|
||||||
.await
|
.await
|
||||||
.log_err()
|
.log_err()
|
||||||
|
@ -546,7 +549,10 @@ async fn upload_previous_panics(
|
||||||
Ok(most_recent_panic)
|
Ok(most_recent_panic)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn upload_previous_minidumps(http: Arc<HttpClientWithUrl>) -> anyhow::Result<()> {
|
pub async fn upload_previous_minidumps(
|
||||||
|
http: Arc<HttpClientWithUrl>,
|
||||||
|
installation_id: Option<String>,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
let Some(minidump_endpoint) = MINIDUMP_ENDPOINT.as_ref() else {
|
let Some(minidump_endpoint) = MINIDUMP_ENDPOINT.as_ref() else {
|
||||||
log::warn!("Minidump endpoint not set");
|
log::warn!("Minidump endpoint not set");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -569,6 +575,7 @@ pub async fn upload_previous_minidumps(http: Arc<HttpClientWithUrl>) -> anyhow::
|
||||||
.await
|
.await
|
||||||
.context("Failed to read minidump")?,
|
.context("Failed to read minidump")?,
|
||||||
&metadata,
|
&metadata,
|
||||||
|
installation_id.clone(),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.log_err()
|
.log_err()
|
||||||
|
@ -586,6 +593,7 @@ async fn upload_minidump(
|
||||||
endpoint: &str,
|
endpoint: &str,
|
||||||
minidump: Vec<u8>,
|
minidump: Vec<u8>,
|
||||||
metadata: &crashes::CrashInfo,
|
metadata: &crashes::CrashInfo,
|
||||||
|
installation_id: Option<String>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut form = Form::new()
|
let mut form = Form::new()
|
||||||
.part(
|
.part(
|
||||||
|
@ -601,7 +609,9 @@ async fn upload_minidump(
|
||||||
.text("sentry[tags][version]", metadata.init.zed_version.clone())
|
.text("sentry[tags][version]", metadata.init.zed_version.clone())
|
||||||
.text("sentry[release]", metadata.init.commit_sha.clone())
|
.text("sentry[release]", metadata.init.commit_sha.clone())
|
||||||
.text("platform", "rust");
|
.text("platform", "rust");
|
||||||
|
let mut panic_message = "".to_owned();
|
||||||
if let Some(panic_info) = metadata.panic.as_ref() {
|
if let Some(panic_info) = metadata.panic.as_ref() {
|
||||||
|
panic_message = panic_info.message.clone();
|
||||||
form = form.text("sentry[logentry][formatted]", panic_info.message.clone());
|
form = form.text("sentry[logentry][formatted]", panic_info.message.clone());
|
||||||
form = form.text("span", panic_info.span.clone());
|
form = form.text("span", panic_info.span.clone());
|
||||||
// TODO: add gpu-context, feature-flag-context, and more of device-context like gpu
|
// TODO: add gpu-context, feature-flag-context, and more of device-context like gpu
|
||||||
|
@ -610,6 +620,16 @@ async fn upload_minidump(
|
||||||
if let Some(minidump_error) = metadata.minidump_error.clone() {
|
if let Some(minidump_error) = metadata.minidump_error.clone() {
|
||||||
form = form.text("minidump_error", minidump_error);
|
form = form.text("minidump_error", minidump_error);
|
||||||
}
|
}
|
||||||
|
if let Some(id) = installation_id.clone() {
|
||||||
|
form = form.text("sentry[user][id]", id)
|
||||||
|
}
|
||||||
|
|
||||||
|
::telemetry::event!(
|
||||||
|
"Minidump Uploaded",
|
||||||
|
panic_message = panic_message,
|
||||||
|
crashed_version = metadata.init.zed_version.clone(),
|
||||||
|
commit_sha = metadata.init.commit_sha.clone(),
|
||||||
|
);
|
||||||
|
|
||||||
let mut response_text = String::new();
|
let mut response_text = String::new();
|
||||||
let mut response = http.send_multipart_form(endpoint, form).await?;
|
let mut response = http.send_multipart_form(endpoint, form).await?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue