agent: Attach thread ID and prompt ID to telemetry events (#29069)

This PR attaches the thread ID and the new prompt ID to telemetry events
for completions in the Agent panel.

Release Notes:

- N/A

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
Marshall Bowers 2025-04-18 16:41:02 -04:00 committed by GitHub
parent 73a767fc45
commit 7abe2c9c31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 85 additions and 9 deletions

View file

@ -719,7 +719,7 @@ impl LanguageModel for CloudLanguageModel {
fn stream_completion_with_usage(
&self,
request: LanguageModelRequest,
mut request: LanguageModelRequest,
_cx: &AsyncApp,
) -> BoxFuture<
'static,
@ -728,6 +728,8 @@ impl LanguageModel for CloudLanguageModel {
Option<RequestUsage>,
)>,
> {
let thread_id = request.prompt_id.take();
let prompt_id = request.prompt_id.take();
match &self.model {
CloudModel::Anthropic(model) => {
let request = into_anthropic(
@ -744,6 +746,8 @@ impl LanguageModel for CloudLanguageModel {
client.clone(),
llm_api_token,
CompletionBody {
thread_id,
prompt_id,
provider: zed_llm_client::LanguageModelProvider::Anthropic,
model: request.model.clone(),
provider_request: serde_json::to_value(&request)?,
@ -788,6 +792,8 @@ impl LanguageModel for CloudLanguageModel {
client.clone(),
llm_api_token,
CompletionBody {
thread_id,
prompt_id,
provider: zed_llm_client::LanguageModelProvider::OpenAi,
model: request.model.clone(),
provider_request: serde_json::to_value(&request)?,
@ -816,6 +822,8 @@ impl LanguageModel for CloudLanguageModel {
client.clone(),
llm_api_token,
CompletionBody {
thread_id,
prompt_id,
provider: zed_llm_client::LanguageModelProvider::Google,
model: request.model.clone(),
provider_request: serde_json::to_value(&request)?,