Add telemetry for user-facing notifications (#48558)
## Summary Adds a "Notification Shown" telemetry event that fires whenever a user-facing notification is displayed in Zed. This helps the team understand error patterns, notification frequency, and which parts of the application generate the most notifications. ## Event Schema | Property | Type | Description | |----------|------|-------------| | `notification_type` | `string` | `"error"` or `"notification"` | | `source` | `string` | Origin category (e.g., `lsp`, `git`, `settings`, `editor`) | | `lsp_name` | `string?` | Language server name (only for LSP notifications) | | `level` | `string?` | Severity: `"critical"`, `"warning"`, or `"info"` | | `has_actions` | `bool` | Whether the notification has action buttons | | `notification_id` | `string` | Debug string of the NotificationId | | `is_auto_dismissing` | `bool` | Whether the notification auto-dismisses | ## NotificationSource Categories A new `NotificationSource` enum categorizes notifications by origin: - `lsp` - Language server notifications - `settings` - Settings/keymap parse errors - `update` - App updates, release notes - `extension` - Extension suggestions/errors - `git` - Git operations, commit errors - `project` - Project-level issues - `collab` - Collaboration notifications - `remote` - SSH/remote project errors - `file` - File access errors - `editor` - Editor operations (search, encoding) - `agent` - AI assistant notifications - `cli` - CLI installation - `system` - Generic fallback ## Privacy **Message content is intentionally not included** in telemetry because: - LSP messages come from external servers and may contain file paths or error chains - Error messages may contain sensitive paths or API-related information - The metadata alone provides sufficient insight for error tracking ## Implementation Updated function signatures to include `NotificationSource`: - `show_notification(id, source, cx, build_fn)` - `show_toast(toast, source, cx)` - `show_error(err, source, cx)` - `show_app_notification(id, source, cx, build_fn)` - `notify_err(workspace, source, cx)` - `notify_async_err(source, cx)` - `notify_app_err(source, cx)` - `detach_and_notify_err(source, window, cx)` Release Notes - N/A (internal telemetry change) --------- Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
b036987b42
commit
2d26605348
47 files changed
+532
-173
No files matched your search
@@ -5,7 +5,7 @@ use release_channel::ReleaseChannel;
|
||||
use std::ops::Deref;
|
||||
use std::path::{Path, PathBuf};
|
||||
use util::ResultExt;
|
||||
use workspace::notifications::{DetachAndPromptErr, NotificationId};
|
||||
use workspace::notifications::{DetachAndPromptErr, NotificationId, NotificationSource};
|
||||
use workspace::{Toast, Workspace};
|
||||
|
||||
actions!(
|
||||
@@ -91,6 +91,7 @@ pub fn install_cli_binary(window: &mut Window, cx: &mut Context<Workspace>) {
|
||||
ReleaseChannel::global(cx).display_name()
|
||||
),
|
||||
),
|
||||
NotificationSource::Cli,
|
||||
cx,
|
||||
)
|
||||
})?;
|
||||
|
||||
Reference in new issue
Block a user