Migrate more events to telemetry::event! macro (#24102)

I believe this takes care of the remaining events running through the
old flow that requires transformation at the collab server level. I
think all events are now going through `telemetry::event!()`.

For anyone curious where the new telemetry names are coming from, you
can check the `for_snowflake` function within
`crates/collab/src/api/events.rs`, to see how collab is currently
transforming the events going through the old flow.

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2025-02-03 11:38:45 -05:00 committed by GitHub
parent a864168c27
commit a8741dc310
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 88 additions and 150 deletions

View file

@ -132,9 +132,7 @@ impl Render for WelcomePage {
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, window, cx| {
this.telemetry.report_app_event(
"welcome page: change theme".to_string(),
);
telemetry::event!("Welcome Theme Changed");
this.workspace
.update(cx, |_workspace, cx| {
window.dispatch_action(zed_actions::theme_selector::Toggle::default().boxed_clone(), cx);
@ -149,9 +147,7 @@ impl Render for WelcomePage {
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, window, cx| {
this.telemetry.report_app_event(
"welcome page: change keymap".to_string(),
);
telemetry::event!("Welcome Keymap Changed");
this.workspace
.update(cx, |workspace, cx| {
base_keymap_picker::toggle(
@ -173,10 +169,8 @@ impl Render for WelcomePage {
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(
cx.listener(|this, _, window, cx| {
this.telemetry.report_app_event(
"welcome page: sign in to copilot".to_string(),
);
cx.listener(|_, _, window, cx| {
telemetry::event!("Welcome Copilot Signed In");
copilot::initiate_sign_in(window, cx);
}),
),
@ -187,10 +181,8 @@ impl Render for WelcomePage {
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, window, cx| {
this.telemetry.report_app_event(
"welcome page: edit settings".to_string(),
);
.on_click(cx.listener(|_, _, window, cx| {
telemetry::event!("Welcome Settings Edited");
window.dispatch_action(Box::new(
zed_actions::OpenSettings,
), cx);
@ -214,10 +206,8 @@ impl Render for WelcomePage {
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, _, cx| {
this.telemetry.report_app_event(
"welcome page: install cli".to_string(),
);
.on_click(cx.listener(|_, _, _, cx| {
telemetry::event!("Welcome CLI Installed");
cx
.spawn(|_, cx| async move {
install_cli::install_cli(&cx).await
@ -232,10 +222,8 @@ impl Render for WelcomePage {
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, _, cx| {
this.telemetry.report_app_event(
"welcome page: view docs".to_string(),
);
.on_click(cx.listener(|_, _, _, cx| {
telemetry::event!("Welcome Documentation Viewed");
cx.open_url(DOCS_URL);
})),
)
@ -245,10 +233,8 @@ impl Render for WelcomePage {
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, window, cx| {
this.telemetry.report_app_event(
"welcome page: open extensions".to_string(),
);
.on_click(cx.listener(|_, _, window, cx| {
telemetry::event!("Welcome Extensions Page Opened");
window.dispatch_action(Box::new(
zed_actions::Extensions,
), cx);
@ -282,8 +268,7 @@ impl Render for WelcomePage {
ui::ToggleState::Unselected
},
cx.listener(move |this, selection, _window, cx| {
this.telemetry
.report_app_event("welcome page: toggle vim".to_string());
telemetry::event!("Welcome Vim Mode Toggled");
this.update_settings::<VimModeSetting>(
selection,
cx,
@ -314,9 +299,7 @@ impl Render for WelcomePage {
ui::ToggleState::Unselected
},
cx.listener(move |this, selection, _window, cx| {
this.telemetry.report_app_event(
"welcome page: toggle diagnostic telemetry".to_string(),
);
telemetry::event!("Welcome Diagnostic Telemetry Toggled");
this.update_settings::<TelemetrySettings>(selection, cx, {
move |settings, value| {
settings.diagnostics = Some(value);
@ -342,9 +325,7 @@ impl Render for WelcomePage {
ui::ToggleState::Unselected
},
cx.listener(move |this, selection, _window, cx| {
this.telemetry.report_app_event(
"welcome page: toggle metric telemetry".to_string(),
);
telemetry::event!("Welcome Metric Telemetry Toggled");
this.update_settings::<TelemetrySettings>(selection, cx, {
move |settings, value| {
settings.metrics = Some(value);
@ -368,9 +349,8 @@ impl Render for WelcomePage {
impl WelcomePage {
pub fn new(workspace: &Workspace, cx: &mut Context<Workspace>) -> Entity<Self> {
let this = cx.new(|cx| {
cx.on_release(|this: &mut Self, _| {
this.telemetry
.report_app_event("welcome page: close".to_string());
cx.on_release(|_: &mut Self, _| {
telemetry::event!("Welcome Page Closed");
})
.detach();
@ -431,7 +411,7 @@ impl Item for WelcomePage {
}
fn telemetry_event_text(&self) -> Option<&'static str> {
Some("welcome page")
Some("Welcome Page Opened")
}
fn show_toolbar(&self) -> bool {