[codex][otel] propagate user email in otel events (#5223)

include user email into otel events for proper user-level attribution in
case of workspace setup
This commit is contained in:
Anton Panasenko
2025-10-15 17:53:33 -07:00
committed by GitHub
parent 5fa7844ad7
commit c146585cdb
9 changed files with 29 additions and 2 deletions

View File

@@ -135,6 +135,10 @@ impl CodexAuth {
self.get_current_token_data().and_then(|t| t.account_id)
}
pub fn get_account_email(&self) -> Option<String> {
self.get_current_token_data().and_then(|t| t.id_token.email)
}
pub(crate) fn get_plan_type(&self) -> Option<PlanType> {
self.get_current_token_data()
.and_then(|t| t.id_token.chatgpt_plan_type)

View File

@@ -1030,6 +1030,7 @@ mod tests {
"test",
"test",
None,
Some("test@test.com".to_string()),
Some(AuthMode::ChatGPT),
false,
"test".to_string(),

View File

@@ -445,6 +445,7 @@ impl Session {
config.model.as_str(),
config.model_family.slug.as_str(),
auth_manager.auth().and_then(|a| a.get_account_id()),
auth_manager.auth().and_then(|a| a.get_account_email()),
auth_manager.auth().map(|a| a.mode),
config.otel.log_user_prompt,
terminal::user_agent(),
@@ -2744,6 +2745,7 @@ mod tests {
config.model.as_str(),
config.model_family.slug.as_str(),
None,
Some("test@test.com".to_string()),
Some(AuthMode::ChatGPT),
false,
"test".to_string(),