Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add project open event
Joseph T. Lyonsb1870af386a7
diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rsindex 0118832fe03..49cb9843f03 100644--- a/crates/client/src/telemetry.rs+++ b/crates/client/src/telemetry.rs@@ -340,18 +340,18 @@ impl Telemetry {self.report_clickhouse_event(event, telemetry_settings, false)}- // app_events are called at app open and app close, so flush is set to immediately sendpub fn report_app_event(self: &Arc<Self>,telemetry_settings: TelemetrySettings,operation: &'static str,+ immediate_flush: bool,) {let event = ClickhouseEvent::App {operation,milliseconds_since_first_event: self.milliseconds_since_first_event(),};- self.report_clickhouse_event(event, telemetry_settings, true)+ self.report_clickhouse_event(event, telemetry_settings, immediate_flush)}fn milliseconds_since_first_event(&self) -> i64 {diff --git a/crates/client2/src/telemetry.rs b/crates/client2/src/telemetry.rsindex e27bc3a4980..f02ff937e4b 100644--- a/crates/client2/src/telemetry.rs+++ b/crates/client2/src/telemetry.rs@@ -173,7 +173,7 @@ impl Telemetry {#[cfg(not(any(test, feature = "test-support")))]fn shutdown_telemetry(self: &Arc<Self>, cx: &mut AppContext) -> impl Future<Output = ()> {let telemetry_settings = TelemetrySettings::get_global(cx).clone();- self.report_app_event(telemetry_settings, "close");+ self.report_app_event(telemetry_settings, "close", true);Task::ready(())}@@ -364,18 +364,18 @@ impl Telemetry {self.report_clickhouse_event(event, telemetry_settings, false)}- // app_events are called at app open and app close, so flush is set to immediately sendpub fn report_app_event(self: &Arc<Self>,telemetry_settings: TelemetrySettings,operation: &'static str,+ immediate_flush: bool,) {let event = ClickhouseEvent::App {operation,milliseconds_since_first_event: self.milliseconds_since_first_event(),};- self.report_clickhouse_event(event, telemetry_settings, true)+ self.report_clickhouse_event(event, telemetry_settings, immediate_flush)}fn milliseconds_since_first_event(&self) -> i64 {diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 455c27a57e1..ee2a8ab104a 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -14,7 +14,7 @@ use anyhow::{anyhow, Context, Result};use call::ActiveCall;use client::{proto::{self, PeerId},- Client, Status, TypedEnvelope, UserStore,+ Client, Status, TelemetrySettings, TypedEnvelope, UserStore,};use collections::{hash_map, HashMap, HashSet};use drag_and_drop::DragAndDrop;@@ -1462,6 +1462,10 @@ impl Workspace {}pub fn open(&mut self, _: &Open, cx: &mut ViewContext<Self>) -> Option<Task<Result<()>>> {+ let telemetry_settings = *settings::get::<TelemetrySettings>(cx);+ self.client()+ .telemetry()+ .report_app_event(telemetry_settings, "open project", false);let mut paths = cx.prompt_for_paths(PathPromptOptions {files: true,directories: true,diff --git a/crates/workspace2/src/workspace2.rs b/crates/workspace2/src/workspace2.rsindex 61083ad2698..0eb6425287f 100644--- a/crates/workspace2/src/workspace2.rs+++ b/crates/workspace2/src/workspace2.rs@@ -15,7 +15,7 @@ use anyhow::{anyhow, Context as _, Result};use call::ActiveCall;use client::{proto::{self, PeerId},- Client, Status, TypedEnvelope, UserStore,+ Client, Status, TelemetrySettings, TypedEnvelope, UserStore,};use collections::{hash_map, HashMap, HashSet};use dock::{Dock, DockPosition, Panel, PanelButtons, PanelHandle};@@ -1250,6 +1250,10 @@ impl Workspace {}pub fn open(&mut self, _: &Open, cx: &mut ViewContext<Self>) {+ let telemetry_settings = TelemetrySettings::get_global(cx).clone();+ self.client()+ .telemetry()+ .report_app_event(telemetry_settings, "open project", false);let paths = cx.prompt_for_paths(PathPromptOptions {files: true,directories: true,diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rsindex 20b93ae6bb4..04f468eb2f0 100644--- a/crates/zed/src/main.rs+++ b/crates/zed/src/main.rs@@ -174,7 +174,7 @@ fn main() {};client.telemetry()- .report_app_event(telemetry_settings, event_operation);+ .report_app_event(telemetry_settings, event_operation, true);let app_state = Arc::new(AppState {languages,diff --git a/crates/zed2/src/main.rs b/crates/zed2/src/main.rsindex 93643648b8c..a885a81f79e 100644--- a/crates/zed2/src/main.rs+++ b/crates/zed2/src/main.rs@@ -184,7 +184,7 @@ fn main() {};client.telemetry()- .report_app_event(telemetry_settings, event_operation);+ .report_app_event(telemetry_settings, event_operation, true);let app_state = Arc::new(AppState {languages: languages.clone(),