ep: LSP telemetry (#58925)
Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #ISSUE Release Notes: - N/A or Added/Fixed/Improved ...
This commit is contained in:
1 parent
8c8fe80a60
commit
0b2a9480f1
3 files changed
+33
No files matched your search
Generated
+1
@@ -5595,6 +5595,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"settings",
|
||||
"smallvec",
|
||||
"telemetry",
|
||||
"text",
|
||||
"tree-sitter",
|
||||
"util",
|
||||
|
||||
@@ -24,6 +24,7 @@ parking_lot.workspace = true
|
||||
project.workspace = true
|
||||
serde.workspace = true
|
||||
smallvec.workspace = true
|
||||
telemetry.workspace = true
|
||||
text.workspace = true
|
||||
tree-sitter.workspace = true
|
||||
util.workspace = true
|
||||
|
||||
@@ -228,9 +228,25 @@ impl RelatedExcerptStore {
|
||||
};
|
||||
|
||||
let file = snapshot.file().cloned();
|
||||
let file_extension = file
|
||||
.as_ref()
|
||||
.and_then(|file| file.path().extension())
|
||||
.unwrap_or("")
|
||||
.to_string();
|
||||
if let Some(file) = &file {
|
||||
log::debug!("retrieving_context buffer:{}", file.path().as_unix_str());
|
||||
}
|
||||
let (lsp_store, is_via_ssh) = project.read_with(cx, |project, _| {
|
||||
(project.lsp_store(), project.is_via_remote_server())
|
||||
});
|
||||
let lsp_names = lsp_store.update(cx, |lsp_store, cx| {
|
||||
buffer.update(cx, |buffer, cx| {
|
||||
lsp_store
|
||||
.running_language_servers_for_local_buffer(buffer, cx)
|
||||
.map(|(_, server)| server.name().to_string())
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
});
|
||||
|
||||
this.update(cx, |_, cx| {
|
||||
cx.emit(RelatedExcerptStoreEvent::StartedRefresh);
|
||||
@@ -400,10 +416,25 @@ impl RelatedExcerptStore {
|
||||
cache_hit_count += 1;
|
||||
}
|
||||
}
|
||||
let lsp_fetch_latency_ms = start_time.elapsed().as_millis();
|
||||
mean_definition_latency /= cache_miss_count.max(1) as u32;
|
||||
|
||||
let (new_cache, related_buffers) =
|
||||
rebuild_related_files(&project, new_cache, &cursor_distances, cx).await?;
|
||||
let latency_ms = start_time.elapsed().as_millis();
|
||||
let returned_excerpt_count = related_buffers
|
||||
.iter()
|
||||
.map(|related_buffer| related_buffer.anchor_ranges.len())
|
||||
.sum::<usize>();
|
||||
telemetry::event!(
|
||||
"Edit Prediction LSP Context Retrieved",
|
||||
lsp_names,
|
||||
file_extension,
|
||||
latency_ms,
|
||||
lsp_fetch_latency_ms,
|
||||
returned_excerpt_count,
|
||||
is_via_ssh
|
||||
);
|
||||
|
||||
if let Some(file) = &file {
|
||||
log::debug!(
|
||||
|
||||
Reference in new issue
Block a user