add originator to otel (#10826)
This commit is contained in:
parent
1fbf5ed06f
commit
daeef06bec
11 changed files with 30 additions and 0 deletions
|
|
@ -981,6 +981,7 @@ impl Session {
|
|||
auth.and_then(CodexAuth::get_account_id),
|
||||
auth.and_then(CodexAuth::get_account_email),
|
||||
auth_mode,
|
||||
crate::default_client::originator().value,
|
||||
config.otel.log_user_prompt,
|
||||
terminal::user_agent(),
|
||||
session_configuration.session_source.clone(),
|
||||
|
|
@ -5775,6 +5776,7 @@ mod tests {
|
|||
None,
|
||||
Some("test@test.com".to_string()),
|
||||
Some(TelemetryAuthMode::Chatgpt),
|
||||
"test_originator".to_string(),
|
||||
false,
|
||||
"test".to_string(),
|
||||
session_source,
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ async fn responses_stream_includes_subagent_header_on_review() {
|
|||
None,
|
||||
Some("test@test.com".to_string()),
|
||||
Some(auth_mode),
|
||||
"test_originator".to_string(),
|
||||
false,
|
||||
"test".to_string(),
|
||||
session_source.clone(),
|
||||
|
|
@ -183,6 +184,7 @@ async fn responses_stream_includes_subagent_header_on_other() {
|
|||
None,
|
||||
Some("test@test.com".to_string()),
|
||||
Some(auth_mode),
|
||||
"test_originator".to_string(),
|
||||
false,
|
||||
"test".to_string(),
|
||||
session_source.clone(),
|
||||
|
|
@ -285,6 +287,7 @@ async fn responses_respects_model_info_overrides_from_config() {
|
|||
None,
|
||||
Some("test@test.com".to_string()),
|
||||
auth_mode,
|
||||
"test_originator".to_string(),
|
||||
false,
|
||||
"test".to_string(),
|
||||
session_source.clone(),
|
||||
|
|
|
|||
|
|
@ -1259,6 +1259,7 @@ async fn azure_responses_request_includes_store_and_reasoning_ids() {
|
|||
None,
|
||||
Some("test@test.com".to_string()),
|
||||
auth_manager.auth_mode().map(TelemetryAuthMode::from),
|
||||
"test_originator".to_string(),
|
||||
false,
|
||||
"test".to_string(),
|
||||
SessionSource::Exec,
|
||||
|
|
|
|||
|
|
@ -702,6 +702,7 @@ async fn websocket_harness_with_options(
|
|||
None,
|
||||
Some("test@test.com".to_string()),
|
||||
auth_manager.auth_mode().map(TelemetryAuthMode::from),
|
||||
"test_originator".to_string(),
|
||||
false,
|
||||
"test".to_string(),
|
||||
SessionSource::Exec,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ pub struct OtelEventMetadata {
|
|||
pub(crate) auth_mode: Option<String>,
|
||||
pub(crate) account_id: Option<String>,
|
||||
pub(crate) account_email: Option<String>,
|
||||
pub(crate) originator: String,
|
||||
pub(crate) session_source: String,
|
||||
pub(crate) model: String,
|
||||
pub(crate) slug: String,
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ impl OtelManager {
|
|||
account_id: Option<String>,
|
||||
account_email: Option<String>,
|
||||
auth_mode: Option<TelemetryAuthMode>,
|
||||
originator: String,
|
||||
log_user_prompts: bool,
|
||||
terminal_type: String,
|
||||
session_source: SessionSource,
|
||||
|
|
@ -76,6 +77,7 @@ impl OtelManager {
|
|||
auth_mode: auth_mode.map(|m| m.to_string()),
|
||||
account_id,
|
||||
account_email,
|
||||
originator,
|
||||
session_source: session_source.to_string(),
|
||||
model: model.to_owned(),
|
||||
slug: slug.to_owned(),
|
||||
|
|
@ -134,6 +136,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -198,6 +201,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -229,6 +233,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -330,6 +335,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -407,6 +413,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -440,6 +447,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -455,6 +463,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -478,6 +487,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -503,6 +513,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -538,6 +549,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -562,6 +574,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -617,6 +630,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
@ -654,6 +668,7 @@ impl OtelManager {
|
|||
conversation.id = %self.metadata.conversation_id,
|
||||
app.version = %self.metadata.app_version,
|
||||
auth_mode = self.metadata.auth_mode,
|
||||
originator = %self.metadata.originator,
|
||||
user.account_id = self.metadata.account_id,
|
||||
user.email = self.metadata.account_email,
|
||||
terminal.type = %self.metadata.terminal_type,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ fn manager_attaches_metadata_tags_to_metrics() -> Result<()> {
|
|||
Some("account-id".to_string()),
|
||||
None,
|
||||
Some(TelemetryAuthMode::ApiKey),
|
||||
"test_originator".to_string(),
|
||||
true,
|
||||
"tty".to_string(),
|
||||
SessionSource::Cli,
|
||||
|
|
@ -77,6 +78,7 @@ fn manager_allows_disabling_metadata_tags() -> Result<()> {
|
|||
Some("account-id".to_string()),
|
||||
None,
|
||||
Some(TelemetryAuthMode::ApiKey),
|
||||
"test_originator".to_string(),
|
||||
true,
|
||||
"tty".to_string(),
|
||||
SessionSource::Cli,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ fn runtime_metrics_summary_collects_tool_api_and_streaming_metrics() -> Result<(
|
|||
Some("account-id".to_string()),
|
||||
None,
|
||||
Some(TelemetryAuthMode::ApiKey),
|
||||
"test_originator".to_string(),
|
||||
true,
|
||||
"tty".to_string(),
|
||||
SessionSource::Cli,
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ fn manager_snapshot_metrics_collects_without_shutdown() -> Result<()> {
|
|||
Some("account-id".to_string()),
|
||||
None,
|
||||
Some(TelemetryAuthMode::ApiKey),
|
||||
"test_originator".to_string(),
|
||||
true,
|
||||
"tty".to_string(),
|
||||
SessionSource::Cli,
|
||||
|
|
|
|||
|
|
@ -986,6 +986,7 @@ impl App {
|
|||
auth_ref.and_then(CodexAuth::get_account_id),
|
||||
auth_ref.and_then(CodexAuth::get_account_email),
|
||||
auth_mode,
|
||||
codex_core::default_client::originator().value,
|
||||
config.otel.log_user_prompt,
|
||||
codex_core::terminal::user_agent(),
|
||||
SessionSource::Cli,
|
||||
|
|
@ -2789,6 +2790,7 @@ mod tests {
|
|||
None,
|
||||
None,
|
||||
None,
|
||||
"test_originator".to_string(),
|
||||
false,
|
||||
"test".to_string(),
|
||||
SessionSource::Cli,
|
||||
|
|
|
|||
|
|
@ -896,6 +896,7 @@ fn test_otel_manager(config: &Config, model: &str) -> OtelManager {
|
|||
None,
|
||||
None,
|
||||
None,
|
||||
"test_originator".to_string(),
|
||||
false,
|
||||
"test".to_string(),
|
||||
SessionSource::Cli,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue