Skip to content

Commit

Permalink
Hide GPU problems from Slack (#18087)
Browse files Browse the repository at this point in the history
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
  • Loading branch information
3 people authored Sep 19, 2024
1 parent 82e6b1e commit edf2c19
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions crates/collab/src/api/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use sha2::{Digest, Sha256};
use std::sync::{Arc, OnceLock};
use telemetry_events::{
ActionEvent, AppEvent, AssistantEvent, CallEvent, CpuEvent, EditEvent, EditorEvent, Event,
EventRequestBody, EventWrapper, ExtensionEvent, InlineCompletionEvent, MemoryEvent, ReplEvent,
SettingEvent,
EventRequestBody, EventWrapper, ExtensionEvent, InlineCompletionEvent, MemoryEvent, Panic,
ReplEvent, SettingEvent,
};
use uuid::Uuid;

Expand Down Expand Up @@ -296,10 +296,11 @@ pub async fn post_panic(
version = %panic.app_version,
os_name = %panic.os_name,
os_version = %panic.os_version.clone().unwrap_or_default(),
installation_id = %panic.installation_id.unwrap_or_default(),
installation_id = %panic.installation_id.clone().unwrap_or_default(),
description = %panic.payload,
backtrace = %panic.backtrace.join("\n"),
"panic report");
"panic report"
);

let backtrace = if panic.backtrace.len() > 25 {
let total = panic.backtrace.len();
Expand All @@ -317,6 +318,11 @@ pub async fn post_panic(
} else {
panic.backtrace.join("\n")
};

if !report_to_slack(&panic) {
return Ok(());
}

let backtrace_with_summary = panic.payload + "\n" + &backtrace;

if let Some(slack_panics_webhook) = app.config.slack_panics_webhook.clone() {
Expand Down Expand Up @@ -357,6 +363,23 @@ pub async fn post_panic(
Ok(())
}

fn report_to_slack(panic: &Panic) -> bool {
if panic.os_name == "Linux" {
if panic.payload.contains("ERROR_SURFACE_LOST_KHR") {
return false;
}

if panic
.payload
.contains("GPU has crashed, and no debug information is available")
{
return false;
}
}

true
}

pub async fn post_events(
Extension(app): Extension<Arc<AppState>>,
TypedHeader(ZedChecksumHeader(checksum)): TypedHeader<ZedChecksumHeader>,
Expand Down

0 comments on commit edf2c19

Please sign in to comment.