ai onboarding: Add telemetry event capturing (#34960)

Release Notes:

- N/A

Co-authored-by: Katie Geer <katie@zed.dev>
Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
This commit is contained in:
Danilo Leal 2025-07-23 14:33:53 -03:00 committed by GitHub
parent 3b428e2ecc
commit fdcd86617a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 6 deletions

1
Cargo.lock generated
View file

@ -347,6 +347,7 @@ dependencies = [
"proto",
"serde",
"smallvec",
"telemetry",
"ui",
"workspace-hack",
"zed_actions",

View file

@ -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,
);

View file

@ -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

View file

@ -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()