Add is_via_ssh field to edit events (#18867)

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2024-10-08 13:13:40 -04:00 committed by GitHub
parent 3da1902e24
commit 77bf2ad0f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 7 deletions

View file

@ -458,7 +458,7 @@ impl Telemetry {
}))
}
pub fn log_edit_event(self: &Arc<Self>, environment: &'static str) {
pub fn log_edit_event(self: &Arc<Self>, environment: &'static str, is_via_ssh: bool) {
let mut state = self.state.lock();
let period_data = state.event_coalescer.log_event(environment);
drop(state);
@ -467,6 +467,7 @@ impl Telemetry {
let event = Event::Edit(EditEvent {
duration: end.timestamp_millis() - start.timestamp_millis(),
environment: environment.to_string(),
is_via_ssh,
});
self.report_event(event);

View file

@ -1263,6 +1263,7 @@ pub struct EditEventRow {
period_start: i64,
period_end: i64,
environment: String,
is_via_ssh: bool,
}
impl EditEventRow {
@ -1296,6 +1297,7 @@ impl EditEventRow {
period_start: period_start.timestamp_millis(),
period_end: period_end.timestamp_millis(),
environment: event.environment,
is_via_ssh: event.is_via_ssh,
}
}
}

View file

@ -12146,9 +12146,14 @@ impl Editor {
}
let Some(project) = &self.project else { return };
let telemetry = project.read(cx).client().telemetry().clone();
let (telemetry, is_via_ssh) = {
let project = project.read(cx);
let telemetry = project.client().telemetry().clone();
let is_via_ssh = project.is_via_ssh();
(telemetry, is_via_ssh)
};
refresh_linked_ranges(self, cx);
telemetry.log_edit_event("editor");
telemetry.log_edit_event("editor", is_via_ssh);
}
multi_buffer::Event::ExcerptsAdded {
buffer,

View file

@ -116,7 +116,7 @@ pub struct EditorEvent {
pub copilot_enabled: bool,
/// Whether the user has copilot enabled for the language of the file opened or saved
pub copilot_enabled_for_language: bool,
/// Whether the client is editing a local file or a remote file via SSH
/// Whether the client is opening/saving a local file or a remote file via SSH
pub is_via_ssh: bool,
}
@ -174,6 +174,8 @@ pub struct ActionEvent {
pub struct EditEvent {
pub duration: i64,
pub environment: String,
/// Whether the edits occurred locally or remotely via SSH
pub is_via_ssh: bool,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]

View file

@ -1019,9 +1019,9 @@ impl InputHandler for TerminalInputHandler {
self.workspace
.update(cx, |this, cx| {
cx.invalidate_character_coordinates();
let telemetry = this.project().read(cx).client().telemetry().clone();
telemetry.log_edit_event("terminal");
let project = this.project().read(cx);
let telemetry = project.client().telemetry().clone();
telemetry.log_edit_event("terminal", project.is_via_ssh());
})
.ok();
}