From 0cd15bad27c01168cc689c3be6ae8da405377ece Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 20:46:04 +0000 Subject: [PATCH] workspace: Move panel telemetry to workspace level (#46809) (cherry-pick to stable) (#47427) Cherry-pick of #46809 to stable ---- This refactors the "Panel Button Clicked" telemetry event to fire from `workspace.rs` instead of `dock.rs`. Previously, the event was emitted in the `PanelButtons` render method's click handler. Now it fires at the workspace level in two places: - `toggle_dock()` - captures panel toggles via dock buttons - `focus_panel()` - captures panel focus via keyboard shortcuts This ensures the telemetry fires once per user action regardless of input method, and retrieves the panel name dynamically via `persistent_name()` rather than relying on a pre-computed local variable. Release Notes: - N/A Co-authored-by: Katie Geer --- crates/workspace/src/dock.rs | 5 ----- crates/workspace/src/workspace.rs | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index 310ef8133e4a4bac1df42becec2b3d6574279431..b3397dd48f58057a78124b1f6124abbb4eb4087b 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -1045,11 +1045,6 @@ impl Render for PanelButtons { .on_click({ let action = action.boxed_clone(); move |_, window, cx| { - telemetry::event!( - "Panel Button Clicked", - name = name, - toggle_state = !is_open - ); window.focus(&focus_handle, cx); window.dispatch_action(action.boxed_clone(), cx) } diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 6ed0fffe3dfbade5a062c9386e2910d39fbcb32f..5a8011bb3579f02cf6d35b764becc4178f16b68a 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -3258,6 +3258,14 @@ impl Workspace { let other_is_zoomed = self.zoomed.is_some() && self.zoomed_position != Some(dock_side); let was_visible = self.is_dock_at_position_open(dock_side, cx) && !other_is_zoomed; + + if let Some(panel) = self.dock_at_position(dock_side).read(cx).active_panel() { + telemetry::event!( + "Panel Button Clicked", + name = panel.persistent_name(), + toggle_state = !was_visible + ); + } if was_visible { self.save_open_dock_positions(cx); } @@ -3418,6 +3426,13 @@ impl Workspace { did_focus_panel = !panel.panel_focus_handle(cx).contains_focused(window, cx); did_focus_panel }); + + telemetry::event!( + "Panel Button Clicked", + name = T::persistent_name(), + toggle_state = did_focus_panel + ); + did_focus_panel }