Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions codex-rs/core/src/codex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,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(),
Expand Down Expand Up @@ -5649,6 +5650,7 @@ mod tests {
None,
Some("test@test.com".to_string()),
Some(TelemetryAuthMode::Chatgpt),
"test_originator".to_string(),
false,
"test".to_string(),
session_source,
Expand Down
3 changes: 3 additions & 0 deletions codex-rs/core/tests/responses_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -182,6 +183,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(),
Expand Down Expand Up @@ -283,6 +285,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(),
Expand Down
1 change: 1 addition & 0 deletions codex-rs/core/tests/suite/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions codex-rs/core/tests/suite/client_websockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ async fn websocket_harness_with_runtime_metrics(
None,
Some("test@test.com".to_string()),
auth_manager.auth_mode().map(TelemetryAuthMode::from),
"test_originator".to_string(),
false,
"test".to_string(),
SessionSource::Exec,
Expand Down
1 change: 1 addition & 0 deletions codex-rs/otel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 15 additions & 0 deletions codex-rs/otel/src/traces/otel_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,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,
Expand All @@ -68,6 +69,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(),
Expand Down Expand Up @@ -126,6 +128,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,
Expand Down Expand Up @@ -190,6 +193,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,
Expand Down Expand Up @@ -221,6 +225,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,
Expand Down Expand Up @@ -322,6 +327,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,
Expand Down Expand Up @@ -399,6 +405,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,
Expand Down Expand Up @@ -432,6 +439,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,
Expand All @@ -447,6 +455,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,
Expand All @@ -470,6 +479,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,
Expand All @@ -495,6 +505,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,
Expand Down Expand Up @@ -530,6 +541,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,
Expand All @@ -554,6 +566,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,
Expand Down Expand Up @@ -609,6 +622,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,
Expand Down Expand Up @@ -646,6 +660,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,
Expand Down
2 changes: 2 additions & 0 deletions codex-rs/otel/tests/suite/manager_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions codex-rs/otel/tests/suite/runtime_summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions codex-rs/otel/tests/suite/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions codex-rs/tui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -2789,6 +2790,7 @@ mod tests {
None,
None,
None,
"test_originator".to_string(),
false,
"test".to_string(),
SessionSource::Cli,
Expand Down
1 change: 1 addition & 0 deletions codex-rs/tui/src/chatwidget/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ fn test_otel_manager(config: &Config, model: &str) -> OtelManager {
None,
None,
None,
"test_originator".to_string(),
false,
"test".to_string(),
SessionSource::Cli,
Expand Down
Loading