Detailed changes
@@ -1550,6 +1550,7 @@ dependencies = [
"anyhow",
"async-recursion 0.3.2",
"async-tungstenite",
+ "chrono",
"collections",
"db",
"feature_flags",
@@ -1586,6 +1587,7 @@ dependencies = [
"anyhow",
"async-recursion 0.3.2",
"async-tungstenite",
+ "chrono",
"collections",
"db2",
"feature_flags2",
@@ -15,7 +15,7 @@ use ai::{
use ai::prompts::repository_context::PromptCodeSnippet;
use anyhow::{anyhow, Result};
use chrono::{DateTime, Local};
-use client::{telemetry::AssistantKind, ClickhouseEvent, TelemetrySettings};
+use client::{telemetry::AssistantKind, TelemetrySettings};
use collections::{hash_map, HashMap, HashSet, VecDeque};
use editor::{
display_map::{
@@ -3803,12 +3803,12 @@ fn report_assistant_event(
.default_open_ai_model
.clone();
- let event = ClickhouseEvent::Assistant {
- conversation_id,
- kind: assistant_kind,
- model: model.full_name(),
- };
let telemetry_settings = *settings::get::<TelemetrySettings>(cx);
- telemetry.report_clickhouse_event(event, telemetry_settings)
+ telemetry.report_assistant_event(
+ telemetry_settings,
+ conversation_id,
+ assistant_kind,
+ model.full_name(),
+ )
}
@@ -5,10 +5,7 @@ pub mod room;
use anyhow::{anyhow, Result};
use audio::Audio;
use call_settings::CallSettings;
-use client::{
- proto, ClickhouseEvent, Client, TelemetrySettings, TypedEnvelope, User, UserStore,
- ZED_ALWAYS_ACTIVE,
-};
+use client::{proto, Client, TelemetrySettings, TypedEnvelope, User, UserStore, ZED_ALWAYS_ACTIVE};
use collections::HashSet;
use futures::{channel::oneshot, future::Shared, Future, FutureExt};
use gpui::{
@@ -485,12 +482,8 @@ pub fn report_call_event_for_room(
) {
let telemetry = client.telemetry();
let telemetry_settings = *settings::get::<TelemetrySettings>(cx);
- let event = ClickhouseEvent::Call {
- operation,
- room_id: Some(room_id),
- channel_id,
- };
- telemetry.report_clickhouse_event(event, telemetry_settings);
+
+ telemetry.report_call_event(telemetry_settings, operation, Some(room_id), channel_id)
}
pub fn report_call_event_for_channel(
@@ -504,12 +497,12 @@ pub fn report_call_event_for_channel(
let telemetry = client.telemetry();
let telemetry_settings = *settings::get::<TelemetrySettings>(cx);
- let event = ClickhouseEvent::Call {
+ telemetry.report_call_event(
+ telemetry_settings,
operation,
- room_id: room.map(|r| r.read(cx).id()),
- channel_id: Some(channel_id),
- };
- telemetry.report_clickhouse_event(event, telemetry_settings);
+ room.map(|r| r.read(cx).id()),
+ Some(channel_id),
+ )
}
#[cfg(test)]
@@ -5,10 +5,7 @@ pub mod room;
use anyhow::{anyhow, Result};
use audio::Audio;
use call_settings::CallSettings;
-use client::{
- proto, ClickhouseEvent, Client, TelemetrySettings, TypedEnvelope, User, UserStore,
- ZED_ALWAYS_ACTIVE,
-};
+use client::{proto, Client, TelemetrySettings, TypedEnvelope, User, UserStore, ZED_ALWAYS_ACTIVE};
use collections::HashSet;
use futures::{channel::oneshot, future::Shared, Future, FutureExt};
use gpui::{
@@ -484,12 +481,8 @@ pub fn report_call_event_for_room(
) {
let telemetry = client.telemetry();
let telemetry_settings = *TelemetrySettings::get_global(cx);
- let event = ClickhouseEvent::Call {
- operation,
- room_id: Some(room_id),
- channel_id,
- };
- telemetry.report_clickhouse_event(event, telemetry_settings);
+
+ telemetry.report_call_event(telemetry_settings, operation, Some(room_id), channel_id)
}
pub fn report_call_event_for_channel(
@@ -504,12 +497,12 @@ pub fn report_call_event_for_channel(
let telemetry_settings = *TelemetrySettings::get_global(cx);
- let event = ClickhouseEvent::Call {
+ telemetry.report_call_event(
+ telemetry_settings,
operation,
- room_id: room.map(|r| r.read(cx).id()),
- channel_id: Some(channel_id),
- };
- telemetry.report_clickhouse_event(event, telemetry_settings);
+ room.map(|r| r.read(cx).id()),
+ Some(channel_id),
+ )
}
#[cfg(test)]
@@ -12,6 +12,7 @@ doctest = false
test-support = ["collections/test-support", "gpui/test-support", "rpc/test-support"]
[dependencies]
+chrono = { version = "0.4", features = ["serde"] }
collections = { path = "../collections" }
db = { path = "../db" }
gpui = { path = "../gpui" }
@@ -1,4 +1,5 @@
use crate::{TelemetrySettings, ZED_SECRET_CLIENT_TOKEN, ZED_SERVER_URL};
+use chrono::{DateTime, Utc};
use gpui::{executor::Background, serde_json, AppContext, Task};
use lazy_static::lazy_static;
use parking_lot::Mutex;
@@ -31,6 +32,7 @@ struct TelemetryState {
flush_clickhouse_events_task: Option<Task<()>>,
log_file: Option<NamedTempFile>,
is_staff: Option<bool>,
+ first_event_datetime: Option<DateTime<Utc>>,
}
const CLICKHOUSE_EVENTS_URL_PATH: &'static str = "/api/events";
@@ -77,42 +79,48 @@ pub enum ClickhouseEvent {
vim_mode: bool,
copilot_enabled: bool,
copilot_enabled_for_language: bool,
+ milliseconds_since_first_event: i64,
},
Copilot {
suggestion_id: Option<String>,
suggestion_accepted: bool,
file_extension: Option<String>,
+ milliseconds_since_first_event: i64,
},
Call {
operation: &'static str,
room_id: Option<u64>,
channel_id: Option<u64>,
+ milliseconds_since_first_event: i64,
},
Assistant {
conversation_id: Option<String>,
kind: AssistantKind,
model: &'static str,
+ milliseconds_since_first_event: i64,
},
Cpu {
usage_as_percentage: f32,
core_count: u32,
+ milliseconds_since_first_event: i64,
},
Memory {
memory_in_bytes: u64,
virtual_memory_in_bytes: u64,
+ milliseconds_since_first_event: i64,
},
}
-#[cfg(debug_assertions)]
-const MAX_QUEUE_LEN: usize = 1;
+// #[cfg(debug_assertions)]
+// const MAX_QUEUE_LEN: usize = 1;
-#[cfg(not(debug_assertions))]
+// #[cfg(not(debug_assertions))]
const MAX_QUEUE_LEN: usize = 10;
-#[cfg(debug_assertions)]
-const DEBOUNCE_INTERVAL: Duration = Duration::from_secs(1);
+// #[cfg(debug_assertions)]
+// const DEBOUNCE_INTERVAL: Duration = Duration::from_secs(1);
-#[cfg(not(debug_assertions))]
+// #[cfg(not(debug_assertions))]
const DEBOUNCE_INTERVAL: Duration = Duration::from_secs(30);
impl Telemetry {
@@ -140,6 +148,7 @@ impl Telemetry {
flush_clickhouse_events_task: Default::default(),
log_file: None,
is_staff: None,
+ first_event_datetime: None,
}),
});
@@ -195,20 +204,18 @@ impl Telemetry {
return;
};
- let memory_event = ClickhouseEvent::Memory {
- memory_in_bytes: process.memory(),
- virtual_memory_in_bytes: process.virtual_memory(),
- };
-
- let cpu_event = ClickhouseEvent::Cpu {
- usage_as_percentage: process.cpu_usage(),
- core_count: system.cpus().len() as u32,
- };
-
let telemetry_settings = cx.update(|cx| *settings::get::<TelemetrySettings>(cx));
- this.report_clickhouse_event(memory_event, telemetry_settings);
- this.report_clickhouse_event(cpu_event, telemetry_settings);
+ this.report_memory_event(
+ telemetry_settings,
+ process.memory(),
+ process.virtual_memory(),
+ );
+ this.report_cpu_event(
+ telemetry_settings,
+ process.cpu_usage(),
+ system.cpus().len() as u32,
+ );
}
})
.detach();
@@ -231,7 +238,123 @@ impl Telemetry {
drop(state);
}
- pub fn report_clickhouse_event(
+ pub fn report_editor_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ file_extension: Option<String>,
+ vim_mode: bool,
+ operation: &'static str,
+ copilot_enabled: bool,
+ copilot_enabled_for_language: bool,
+ ) {
+ let event = ClickhouseEvent::Editor {
+ file_extension,
+ vim_mode,
+ operation,
+ copilot_enabled,
+ copilot_enabled_for_language,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_copilot_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ suggestion_id: Option<String>,
+ suggestion_accepted: bool,
+ file_extension: Option<String>,
+ ) {
+ let event = ClickhouseEvent::Copilot {
+ suggestion_id,
+ suggestion_accepted,
+ file_extension,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_assistant_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ conversation_id: Option<String>,
+ kind: AssistantKind,
+ model: &'static str,
+ ) {
+ let event = ClickhouseEvent::Assistant {
+ conversation_id,
+ kind,
+ model,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_call_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ operation: &'static str,
+ room_id: Option<u64>,
+ channel_id: Option<u64>,
+ ) {
+ let event = ClickhouseEvent::Call {
+ operation,
+ room_id,
+ channel_id,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_cpu_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ usage_as_percentage: f32,
+ core_count: u32,
+ ) {
+ let event = ClickhouseEvent::Cpu {
+ usage_as_percentage,
+ core_count,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_memory_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ memory_in_bytes: u64,
+ virtual_memory_in_bytes: u64,
+ ) {
+ let event = ClickhouseEvent::Memory {
+ memory_in_bytes,
+ virtual_memory_in_bytes,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ fn milliseconds_since_first_event(&self) -> i64 {
+ let mut state = self.state.lock();
+ match state.first_event_datetime {
+ Some(first_event_datetime) => {
+ let now: DateTime<Utc> = Utc::now();
+ now.timestamp_millis() - first_event_datetime.timestamp_millis()
+ }
+ None => {
+ state.first_event_datetime = Some(Utc::now());
+ 0
+ }
+ }
+ }
+
+ fn report_clickhouse_event(
self: &Arc<Self>,
event: ClickhouseEvent,
telemetry_settings: TelemetrySettings,
@@ -246,6 +369,8 @@ impl Telemetry {
.clickhouse_events_queue
.push(ClickhouseEventWrapper { signed_in, event });
+ dbg!(state.clickhouse_events_queue.len(), chrono::Utc::now());
+
if state.installation_id.is_some() {
if state.clickhouse_events_queue.len() >= MAX_QUEUE_LEN {
drop(state);
@@ -275,6 +400,7 @@ impl Telemetry {
fn flush_clickhouse_events(self: &Arc<Self>) {
let mut state = self.state.lock();
+ state.first_event_datetime = None;
let mut events = mem::take(&mut state.clickhouse_events_queue);
state.flush_clickhouse_events_task.take();
drop(state);
@@ -310,6 +436,7 @@ impl Telemetry {
release_channel: state.release_channel,
events,
};
+ dbg!(&request_body);
json_bytes.clear();
serde_json::to_writer(&mut json_bytes, &request_body)?;
}
@@ -12,6 +12,7 @@ doctest = false
test-support = ["collections/test-support", "gpui/test-support", "rpc/test-support"]
[dependencies]
+chrono = { version = "0.4", features = ["serde"] }
collections = { path = "../collections" }
db = { package = "db2", path = "../db2" }
gpui = { package = "gpui2", path = "../gpui2" }
@@ -1,4 +1,5 @@
use crate::{TelemetrySettings, ZED_SECRET_CLIENT_TOKEN, ZED_SERVER_URL};
+use chrono::{DateTime, Utc};
use gpui::{serde_json, AppContext, AppMetadata, BackgroundExecutor, Task};
use lazy_static::lazy_static;
use parking_lot::Mutex;
@@ -29,6 +30,7 @@ struct TelemetryState {
flush_clickhouse_events_task: Option<Task<()>>,
log_file: Option<NamedTempFile>,
is_staff: Option<bool>,
+ first_event_datetime: Option<DateTime<Utc>>,
}
const CLICKHOUSE_EVENTS_URL_PATH: &'static str = "/api/events";
@@ -75,42 +77,48 @@ pub enum ClickhouseEvent {
vim_mode: bool,
copilot_enabled: bool,
copilot_enabled_for_language: bool,
+ milliseconds_since_first_event: i64,
},
Copilot {
suggestion_id: Option<String>,
suggestion_accepted: bool,
file_extension: Option<String>,
+ milliseconds_since_first_event: i64,
},
Call {
operation: &'static str,
room_id: Option<u64>,
channel_id: Option<u64>,
+ milliseconds_since_first_event: i64,
},
Assistant {
conversation_id: Option<String>,
kind: AssistantKind,
model: &'static str,
+ milliseconds_since_first_event: i64,
},
Cpu {
usage_as_percentage: f32,
core_count: u32,
+ milliseconds_since_first_event: i64,
},
Memory {
memory_in_bytes: u64,
virtual_memory_in_bytes: u64,
+ milliseconds_since_first_event: i64,
},
}
-#[cfg(debug_assertions)]
-const MAX_QUEUE_LEN: usize = 1;
+// #[cfg(debug_assertions)]
+// const MAX_QUEUE_LEN: usize = 1;
-#[cfg(not(debug_assertions))]
+// #[cfg(not(debug_assertions))]
const MAX_QUEUE_LEN: usize = 10;
-#[cfg(debug_assertions)]
-const DEBOUNCE_INTERVAL: Duration = Duration::from_secs(1);
+// #[cfg(debug_assertions)]
+// const DEBOUNCE_INTERVAL: Duration = Duration::from_secs(1);
-#[cfg(not(debug_assertions))]
+// #[cfg(not(debug_assertions))]
const DEBOUNCE_INTERVAL: Duration = Duration::from_secs(30);
impl Telemetry {
@@ -135,6 +143,7 @@ impl Telemetry {
flush_clickhouse_events_task: Default::default(),
log_file: None,
is_staff: None,
+ first_event_datetime: None,
}),
});
@@ -190,16 +199,6 @@ impl Telemetry {
return;
};
- let memory_event = ClickhouseEvent::Memory {
- memory_in_bytes: process.memory(),
- virtual_memory_in_bytes: process.virtual_memory(),
- };
-
- let cpu_event = ClickhouseEvent::Cpu {
- usage_as_percentage: process.cpu_usage(),
- core_count: system.cpus().len() as u32,
- };
-
let telemetry_settings = if let Ok(telemetry_settings) =
cx.update(|cx| *TelemetrySettings::get_global(cx))
{
@@ -208,8 +207,16 @@ impl Telemetry {
break;
};
- this.report_clickhouse_event(memory_event, telemetry_settings);
- this.report_clickhouse_event(cpu_event, telemetry_settings);
+ this.report_memory_event(
+ telemetry_settings,
+ process.memory(),
+ process.virtual_memory(),
+ );
+ this.report_cpu_event(
+ telemetry_settings,
+ process.cpu_usage(),
+ system.cpus().len() as u32,
+ );
}
})
.detach();
@@ -232,7 +239,123 @@ impl Telemetry {
drop(state);
}
- pub fn report_clickhouse_event(
+ pub fn report_editor_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ file_extension: Option<String>,
+ vim_mode: bool,
+ operation: &'static str,
+ copilot_enabled: bool,
+ copilot_enabled_for_language: bool,
+ ) {
+ let event = ClickhouseEvent::Editor {
+ file_extension,
+ vim_mode,
+ operation,
+ copilot_enabled,
+ copilot_enabled_for_language,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_copilot_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ suggestion_id: Option<String>,
+ suggestion_accepted: bool,
+ file_extension: Option<String>,
+ ) {
+ let event = ClickhouseEvent::Copilot {
+ suggestion_id,
+ suggestion_accepted,
+ file_extension,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_assistant_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ conversation_id: Option<String>,
+ kind: AssistantKind,
+ model: &'static str,
+ ) {
+ let event = ClickhouseEvent::Assistant {
+ conversation_id,
+ kind,
+ model,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_call_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ operation: &'static str,
+ room_id: Option<u64>,
+ channel_id: Option<u64>,
+ ) {
+ let event = ClickhouseEvent::Call {
+ operation,
+ room_id,
+ channel_id,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_cpu_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ usage_as_percentage: f32,
+ core_count: u32,
+ ) {
+ let event = ClickhouseEvent::Cpu {
+ usage_as_percentage,
+ core_count,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ pub fn report_memory_event(
+ self: &Arc<Self>,
+ telemetry_settings: TelemetrySettings,
+ memory_in_bytes: u64,
+ virtual_memory_in_bytes: u64,
+ ) {
+ let event = ClickhouseEvent::Memory {
+ memory_in_bytes,
+ virtual_memory_in_bytes,
+ milliseconds_since_first_event: self.milliseconds_since_first_event(),
+ };
+
+ self.report_clickhouse_event(event, telemetry_settings)
+ }
+
+ fn milliseconds_since_first_event(&self) -> i64 {
+ let mut state = self.state.lock();
+ match state.first_event_datetime {
+ Some(first_event_datetime) => {
+ let now: DateTime<Utc> = Utc::now();
+ now.timestamp_millis() - first_event_datetime.timestamp_millis()
+ }
+ None => {
+ state.first_event_datetime = Some(Utc::now());
+ 0
+ }
+ }
+ }
+
+ fn report_clickhouse_event(
self: &Arc<Self>,
event: ClickhouseEvent,
telemetry_settings: TelemetrySettings,
@@ -247,6 +370,9 @@ impl Telemetry {
.clickhouse_events_queue
.push(ClickhouseEventWrapper { signed_in, event });
+ dbg!(state.clickhouse_events_queue.len(), chrono::Utc::now());
+ dbg!(state.installation_id.is_some());
+
if state.installation_id.is_some() {
if state.clickhouse_events_queue.len() >= MAX_QUEUE_LEN {
drop(state);
@@ -276,10 +402,13 @@ impl Telemetry {
fn flush_clickhouse_events(self: &Arc<Self>) {
let mut state = self.state.lock();
+ state.first_event_datetime = None;
let mut events = mem::take(&mut state.clickhouse_events_queue);
state.flush_clickhouse_events_task.take();
drop(state);
+ dbg!("In flush");
+
let this = self.clone();
self.executor
.spawn(
@@ -317,6 +446,7 @@ impl Telemetry {
release_channel: state.release_channel,
events,
};
+ dbg!(&request_body);
json_bytes.clear();
serde_json::to_writer(&mut json_bytes, &request_body)?;
}
@@ -24,7 +24,7 @@ use ::git::diff::DiffHunk;
use aho_corasick::AhoCorasick;
use anyhow::{anyhow, Context, Result};
use blink_manager::BlinkManager;
-use client::{ClickhouseEvent, Client, Collaborator, ParticipantIndex, TelemetrySettings};
+use client::{Client, Collaborator, ParticipantIndex, TelemetrySettings};
use clock::{Global, ReplicaId};
use collections::{BTreeMap, Bound, HashMap, HashSet, VecDeque};
use convert_case::{Case, Casing};
@@ -8946,12 +8946,12 @@ impl Editor {
let telemetry = project.read(cx).client().telemetry().clone();
let telemetry_settings = *settings::get::<TelemetrySettings>(cx);
- let event = ClickhouseEvent::Copilot {
+ telemetry.report_copilot_event(
+ telemetry_settings,
suggestion_id,
suggestion_accepted,
file_extension,
- };
- telemetry.report_clickhouse_event(event, telemetry_settings);
+ )
}
#[cfg(any(test, feature = "test-support"))]
@@ -8998,14 +8998,14 @@ impl Editor {
.show_copilot_suggestions;
let telemetry = project.read(cx).client().telemetry().clone();
- let event = ClickhouseEvent::Editor {
+ telemetry.report_editor_event(
+ telemetry_settings,
file_extension,
vim_mode,
operation,
copilot_enabled,
copilot_enabled_for_language,
- };
- telemetry.report_clickhouse_event(event, telemetry_settings)
+ )
}
/// Copy the highlighted chunks to the clipboard as JSON. The format is an array of lines,
@@ -24,7 +24,7 @@ use ::git::diff::DiffHunk;
use aho_corasick::AhoCorasick;
use anyhow::{anyhow, Context as _, Result};
use blink_manager::BlinkManager;
-use client::{ClickhouseEvent, Client, Collaborator, ParticipantIndex, TelemetrySettings};
+use client::{Client, Collaborator, ParticipantIndex, TelemetrySettings};
use clock::ReplicaId;
use collections::{BTreeMap, Bound, HashMap, HashSet, VecDeque};
use convert_case::{Case, Casing};
@@ -8968,12 +8968,12 @@ impl Editor {
let telemetry = project.read(cx).client().telemetry().clone();
let telemetry_settings = *TelemetrySettings::get_global(cx);
- let event = ClickhouseEvent::Copilot {
+ telemetry.report_copilot_event(
+ telemetry_settings,
suggestion_id,
suggestion_accepted,
file_extension,
- };
- telemetry.report_clickhouse_event(event, telemetry_settings);
+ )
}
#[cfg(any(test, feature = "test-support"))]
@@ -8985,7 +8985,7 @@ impl Editor {
) {
}
- #[cfg(not(any(test, feature = "test-support")))]
+ // #[cfg(not(any(test, feature = "test-support")))]
fn report_editor_event(
&self,
operation: &'static str,
@@ -9020,14 +9020,14 @@ impl Editor {
.show_copilot_suggestions;
let telemetry = project.read(cx).client().telemetry().clone();
- let event = ClickhouseEvent::Editor {
+ telemetry.report_editor_event(
+ telemetry_settings,
file_extension,
vim_mode,
operation,
copilot_enabled,
copilot_enabled_for_language,
- };
- telemetry.report_clickhouse_event(event, telemetry_settings)
+ )
}
/// Copy the highlighted chunks to the clipboard as JSON. The format is an array of lines,
@@ -3,6 +3,7 @@
use anyhow::{anyhow, Context, Result};
use backtrace::Backtrace;
+use chrono::{DateTime, Utc};
use cli::FORCE_CLI_MODE_ENV_VAR_NAME;
use client::{
self, Client, TelemetrySettings, UserStore, ZED_APP_VERSION, ZED_SECRET_CLIENT_TOKEN,
@@ -490,10 +491,7 @@ fn init_panic_hook(app: &App, installation_id: Option<String>, session_id: Strin
.ok()
.map(|os_version| os_version.to_string()),
architecture: env::consts::ARCH.into(),
- panicked_on: SystemTime::now()
- .duration_since(UNIX_EPOCH)
- .unwrap()
- .as_millis(),
+ panicked_on: Utc::now().timestamp_millis(),
backtrace,
installation_id: installation_id.clone(),
session_id: session_id.clone(),
@@ -6,6 +6,7 @@
use anyhow::{anyhow, Context as _, Result};
use backtrace::Backtrace;
+use chrono::{DateTime, Utc};
use cli::FORCE_CLI_MODE_ENV_VAR_NAME;
use client::UserStore;
use db::kvp::KEY_VALUE_STORE;
@@ -72,6 +73,7 @@ fn main() {
let app = App::production(Arc::new(Assets));
let installation_id = app.background_executor().block(installation_id()).ok();
+ dbg!("HERE", &installation_id);
let session_id = Uuid::new_v4().to_string();
init_panic_hook(&app, installation_id.clone(), session_id.clone());
@@ -172,7 +174,7 @@ fn main() {
// })
// .detach();
- // client.telemetry().start(installation_id, session_id, cx);
+ client.telemetry().start(installation_id, session_id, cx);
let app_state = Arc::new(AppState {
languages,
@@ -514,10 +516,7 @@ fn init_panic_hook(app: &App, installation_id: Option<String>, session_id: Strin
.as_ref()
.map(SemanticVersion::to_string),
architecture: env::consts::ARCH.into(),
- panicked_on: SystemTime::now()
- .duration_since(UNIX_EPOCH)
- .unwrap()
- .as_millis(),
+ panicked_on: Utc::now().timestamp_millis(),
backtrace,
installation_id: installation_id.clone(),
session_id: session_id.clone(),