Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

ai onboarding: Add telemetry event capturing (#34960)

Danilo Lealfdcd86617a82
diff --git a/Cargo.lock b/Cargo.lock
index 765ae002498..8be4c9d7be7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -347,6 +347,7 @@ dependencies = [
"proto",
"serde",
"smallvec",
+ "telemetry",
"ui",
"workspace-hack",
"zed_actions",
diff --git a/crates/agent_ui/src/message_editor.rs b/crates/agent_ui/src/message_editor.rs
index 78037532925..ab8ba762f4e 100644
--- a/crates/agent_ui/src/message_editor.rs
+++ b/crates/agent_ui/src/message_editor.rs
@@ -910,6 +910,10 @@ impl MessageEditor {
.on_click({
let focus_handle = focus_handle.clone();
move |_event, window, cx| {
+ telemetry::event!(
+ "Agent Message Sent",
+ agent = "zed",
+ );
focus_handle.dispatch_action(
&Chat, window, cx,
);
diff --git a/crates/ai_onboarding/Cargo.toml b/crates/ai_onboarding/Cargo.toml
index e9208a72486..9031e14e29d 100644
--- a/crates/ai_onboarding/Cargo.toml
+++ b/crates/ai_onboarding/Cargo.toml
@@ -22,6 +22,7 @@ language_model.workspace = true
proto.workspace = true
serde.workspace = true
smallvec.workspace = true
+telemetry.workspace = true
ui.workspace = true
workspace-hack.workspace = true
zed_actions.workspace = true
diff --git a/crates/ai_onboarding/src/ai_onboarding.rs b/crates/ai_onboarding/src/ai_onboarding.rs
index e8ce22ff4e5..9d32b1ee09b 100644
--- a/crates/ai_onboarding/src/ai_onboarding.rs
+++ b/crates/ai_onboarding/src/ai_onboarding.rs
@@ -183,6 +183,7 @@ impl ZedAiOnboarding {
.full_width()
.style(ButtonStyle::Tinted(ui::TintColor::Accent))
.on_click(move |_, _window, cx| {
+ telemetry::event!("Upgrade To Pro Clicked", state = "young-account");
cx.open_url(&zed_urls::upgrade_to_zed_pro_url(cx))
}),
)
@@ -210,6 +211,7 @@ impl ZedAiOnboarding {
.full_width()
.style(ButtonStyle::Tinted(ui::TintColor::Accent))
.on_click(move |_, _window, cx| {
+ telemetry::event!("Start Trial Clicked", state = "post-sign-in");
cx.open_url(&zed_urls::start_trial_url(cx))
}),
)
@@ -234,7 +236,10 @@ impl ZedAiOnboarding {
.icon(IconName::ArrowUpRight)
.icon_color(Color::Muted)
.icon_size(IconSize::XSmall)
- .on_click(move |_, _window, cx| cx.open_url(&zed_urls::terms_of_service(cx))),
+ .on_click(move |_, _window, cx| {
+ telemetry::event!("Review Terms of Service Click");
+ cx.open_url(&zed_urls::terms_of_service(cx))
+ }),
)
.child(
Button::new("accept_terms", "Accept")
@@ -242,7 +247,9 @@ impl ZedAiOnboarding {
.style(ButtonStyle::Tinted(TintColor::Accent))
.on_click({
let callback = self.accept_terms_of_service.clone();
- move |_, window, cx| (callback)(window, cx)
+ move |_, window, cx| {
+ telemetry::event!("Accepted Terms of Service");
+ (callback)(window, cx)}
}),
)
.into_any_element()
@@ -267,7 +274,10 @@ impl ZedAiOnboarding {
.style(ButtonStyle::Tinted(ui::TintColor::Accent))
.on_click({
let callback = self.sign_in.clone();
- move |_, window, cx| callback(window, cx)
+ move |_, window, cx| {
+ telemetry::event!("Start Trial Clicked", state = "pre-sign-in");
+ callback(window, cx)
+ }
}),
)
.into_any_element()
@@ -294,7 +304,13 @@ impl ZedAiOnboarding {
IconButton::new("dismiss_onboarding", IconName::Close)
.icon_size(IconSize::Small)
.tooltip(Tooltip::text("Dismiss"))
- .on_click(move |_, window, cx| callback(window, cx)),
+ .on_click(move |_, window, cx| {
+ telemetry::event!(
+ "Banner Dismissed",
+ source = "AI Onboarding",
+ );
+ callback(window, cx)
+ }),
),
)
},
@@ -331,7 +347,13 @@ impl ZedAiOnboarding {
IconButton::new("dismiss_onboarding", IconName::Close)
.icon_size(IconSize::Small)
.tooltip(Tooltip::text("Dismiss"))
- .on_click(move |_, window, cx| callback(window, cx)),
+ .on_click(move |_, window, cx| {
+ telemetry::event!(
+ "Banner Dismissed",
+ source = "AI Onboarding",
+ );
+ callback(window, cx)
+ }),
),
)
},
@@ -359,7 +381,10 @@ impl ZedAiOnboarding {
.style(ButtonStyle::Outlined)
.on_click({
let callback = self.continue_with_zed_ai.clone();
- move |_, window, cx| callback(window, cx)
+ move |_, window, cx| {
+ telemetry::event!("Banner Dismissed", source = "AI Onboarding");
+ callback(window, cx)
+ }
}),
)
.into_any_element()