agent: Add thread history import telemetry (#59050)
## Summary - Emit `Thread History Viewed` from the shared archive/history opening path so it covers button, keyboard, and onboarding entry points. - Emit `Agent Threads Import Clicked` when users open external-agent thread import from thread history or onboarding. - Emit `Agent Threads Import Clicked` when users click cross-channel thread import onboarding. ## Tests - `cargo fmt --check` - `git diff --check` - `./script/clippy -p sidebar` - `cargo test -p sidebar` Release Notes: - N/A
This commit is contained in:
1 parent
25a1b1e503
commit
baa7171923
1 file changed
+31
-8
@@ -7458,7 +7458,21 @@ impl Sidebar {
|
|||||||
.map(|w| w.read(cx).workspace().clone())
|
.map(|w| w.read(cx).workspace().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_thread_import_modal(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn show_thread_import_modal(
|
||||||
|
&mut self,
|
||||||
|
source: &'static str,
|
||||||
|
window: &mut Window,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
telemetry::event!(
|
||||||
|
"Agent Threads Import Clicked",
|
||||||
|
source = source,
|
||||||
|
side = match self.side(cx) {
|
||||||
|
SidebarSide::Left => "left",
|
||||||
|
SidebarSide::Right => "right",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
let Some(active_workspace) = self.active_workspace(cx) else {
|
let Some(active_workspace) = self.active_workspace(cx) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -7514,7 +7528,7 @@ impl Sidebar {
|
|||||||
) -> impl IntoElement {
|
) -> impl IntoElement {
|
||||||
let on_import = cx.listener(|this, _, window, cx| {
|
let on_import = cx.listener(|this, _, window, cx| {
|
||||||
this.show_archive(window, cx);
|
this.show_archive(window, cx);
|
||||||
this.show_thread_import_modal(window, cx);
|
this.show_thread_import_modal("external_agent_onboarding", window, cx);
|
||||||
});
|
});
|
||||||
render_import_onboarding_banner(
|
render_import_onboarding_banner(
|
||||||
"acp",
|
"acp",
|
||||||
@@ -7553,6 +7567,14 @@ impl Sidebar {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let on_import = cx.listener(|this, _, _window, cx| {
|
let on_import = cx.listener(|this, _, _window, cx| {
|
||||||
|
telemetry::event!(
|
||||||
|
"Agent Threads Import Clicked",
|
||||||
|
source = "cross_channel_onboarding",
|
||||||
|
side = match this.side(cx) {
|
||||||
|
SidebarSide::Left => "left",
|
||||||
|
SidebarSide::Right => "right",
|
||||||
|
}
|
||||||
|
);
|
||||||
CrossChannelImportOnboarding::dismiss(cx);
|
CrossChannelImportOnboarding::dismiss(cx);
|
||||||
if let Some(workspace) = this.active_workspace(cx) {
|
if let Some(workspace) = this.active_workspace(cx) {
|
||||||
workspace.update(cx, |workspace, cx| {
|
workspace.update(cx, |workspace, cx| {
|
||||||
@@ -7583,11 +7605,6 @@ impl Sidebar {
|
|||||||
) {
|
) {
|
||||||
match &self.view {
|
match &self.view {
|
||||||
SidebarView::ThreadList => {
|
SidebarView::ThreadList => {
|
||||||
let side = match self.side(cx) {
|
|
||||||
SidebarSide::Left => "left",
|
|
||||||
SidebarSide::Right => "right",
|
|
||||||
};
|
|
||||||
telemetry::event!("Thread History Viewed", side = side);
|
|
||||||
self.show_archive(window, cx);
|
self.show_archive(window, cx);
|
||||||
}
|
}
|
||||||
SidebarView::Archive(_) => self.show_thread_list(window, cx),
|
SidebarView::Archive(_) => self.show_thread_list(window, cx),
|
||||||
@@ -7595,6 +7612,12 @@ impl Sidebar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn show_archive(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn show_archive(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
|
let side = match self.side(cx) {
|
||||||
|
SidebarSide::Left => "left",
|
||||||
|
SidebarSide::Right => "right",
|
||||||
|
};
|
||||||
|
telemetry::event!("Thread History Viewed", side = side);
|
||||||
|
|
||||||
let Some(active_workspace) = self
|
let Some(active_workspace) = self
|
||||||
.multi_workspace
|
.multi_workspace
|
||||||
.upgrade()
|
.upgrade()
|
||||||
@@ -7639,7 +7662,7 @@ impl Sidebar {
|
|||||||
this.restoring_tasks.remove(thread_id);
|
this.restoring_tasks.remove(thread_id);
|
||||||
}
|
}
|
||||||
ThreadsArchiveViewEvent::Import => {
|
ThreadsArchiveViewEvent::Import => {
|
||||||
this.show_thread_import_modal(window, cx);
|
this.show_thread_import_modal("thread_history", window, cx);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user