Add telemetry::event! (#22146)

CC @JosephTLyons

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin
2024-12-17 11:39:18 -07:00
committed by GitHub
parent b17f2089a2
commit 7425d242bc
24 changed files with 179 additions and 140 deletions
+6 -7
View File
@@ -1370,7 +1370,7 @@ impl Editor {
}
}
this.report_editor_event("open", None, cx);
this.report_editor_event("Editor Opened", None, cx);
this
}
@@ -12568,7 +12568,7 @@ impl Editor {
fn report_editor_event(
&self,
operation: &'static str,
event_type: &'static str,
file_extension: Option<String>,
cx: &AppContext,
) {
@@ -12605,15 +12605,14 @@ impl Editor {
.show_inline_completions;
let project = project.read(cx);
let telemetry = project.client().telemetry().clone();
telemetry.report_editor_event(
telemetry::event!(
event_type,
file_extension,
vim_mode,
operation,
copilot_enabled,
copilot_enabled_for_language,
project.is_via_ssh(),
)
is_via_ssh = project.is_via_ssh(),
);
}
/// Copy the highlighted chunks to the clipboard as JSON. The format is an array of lines,
+2 -2
View File
@@ -733,7 +733,7 @@ impl Item for Editor {
project: Model<Project>,
cx: &mut ViewContext<Self>,
) -> Task<Result<()>> {
self.report_editor_event("save", None, cx);
self.report_editor_event("Editor Saved", None, cx);
let buffers = self.buffer().clone().read(cx).all_buffers();
let buffers = buffers
.into_iter()
@@ -805,7 +805,7 @@ impl Item for Editor {
.path
.extension()
.map(|a| a.to_string_lossy().to_string());
self.report_editor_event("save", file_extension, cx);
self.report_editor_event("Editor Saved", file_extension, cx);
project.update(cx, |project, cx| project.save_buffer_as(buffer, path, cx))
}