zeta: Add latency telemetry for 1% of edit predictions (#36020)
Release Notes: - N/A Co-authored-by: Oleksiy <oleksiy@zed.dev>
This commit is contained in:
parent
52a9101970
commit
cc5eb24066
3 changed files with 25 additions and 3 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -20923,6 +20923,7 @@ dependencies = [
|
||||||
"menu",
|
"menu",
|
||||||
"postage",
|
"postage",
|
||||||
"project",
|
"project",
|
||||||
|
"rand 0.8.5",
|
||||||
"regex",
|
"regex",
|
||||||
"release_channel",
|
"release_channel",
|
||||||
"reqwest_client",
|
"reqwest_client",
|
||||||
|
|
|
@ -26,6 +26,7 @@ collections.workspace = true
|
||||||
command_palette_hooks.workspace = true
|
command_palette_hooks.workspace = true
|
||||||
copilot.workspace = true
|
copilot.workspace = true
|
||||||
db.workspace = true
|
db.workspace = true
|
||||||
|
edit_prediction.workspace = true
|
||||||
editor.workspace = true
|
editor.workspace = true
|
||||||
feature_flags.workspace = true
|
feature_flags.workspace = true
|
||||||
fs.workspace = true
|
fs.workspace = true
|
||||||
|
@ -33,13 +34,13 @@ futures.workspace = true
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
http_client.workspace = true
|
http_client.workspace = true
|
||||||
indoc.workspace = true
|
indoc.workspace = true
|
||||||
edit_prediction.workspace = true
|
|
||||||
language.workspace = true
|
language.workspace = true
|
||||||
language_model.workspace = true
|
language_model.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
menu.workspace = true
|
menu.workspace = true
|
||||||
postage.workspace = true
|
postage.workspace = true
|
||||||
project.workspace = true
|
project.workspace = true
|
||||||
|
rand.workspace = true
|
||||||
regex.workspace = true
|
regex.workspace = true
|
||||||
release_channel.workspace = true
|
release_channel.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
|
|
|
@ -429,6 +429,7 @@ impl Zeta {
|
||||||
body,
|
body,
|
||||||
editable_range,
|
editable_range,
|
||||||
} = gather_task.await?;
|
} = gather_task.await?;
|
||||||
|
let done_gathering_context_at = Instant::now();
|
||||||
|
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Events:\n{}\nExcerpt:\n{:?}",
|
"Events:\n{}\nExcerpt:\n{:?}",
|
||||||
|
@ -481,6 +482,7 @@ impl Zeta {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let received_response_at = Instant::now();
|
||||||
log::debug!("completion response: {}", &response.output_excerpt);
|
log::debug!("completion response: {}", &response.output_excerpt);
|
||||||
|
|
||||||
if let Some(usage) = usage {
|
if let Some(usage) = usage {
|
||||||
|
@ -492,7 +494,7 @@ impl Zeta {
|
||||||
.ok();
|
.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::process_completion_response(
|
let edit_prediction = Self::process_completion_response(
|
||||||
response,
|
response,
|
||||||
buffer,
|
buffer,
|
||||||
&snapshot,
|
&snapshot,
|
||||||
|
@ -505,7 +507,25 @@ impl Zeta {
|
||||||
buffer_snapshotted_at,
|
buffer_snapshotted_at,
|
||||||
&cx,
|
&cx,
|
||||||
)
|
)
|
||||||
.await
|
.await;
|
||||||
|
|
||||||
|
let finished_at = Instant::now();
|
||||||
|
|
||||||
|
// record latency for ~1% of requests
|
||||||
|
if rand::random::<u8>() <= 2 {
|
||||||
|
telemetry::event!(
|
||||||
|
"Edit Prediction Request",
|
||||||
|
context_latency = done_gathering_context_at
|
||||||
|
.duration_since(buffer_snapshotted_at)
|
||||||
|
.as_millis(),
|
||||||
|
request_latency = received_response_at
|
||||||
|
.duration_since(done_gathering_context_at)
|
||||||
|
.as_millis(),
|
||||||
|
process_latency = finished_at.duration_since(received_response_at).as_millis()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
edit_prediction
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue