From ed64804cb52372f63f7e0f64a6c716a46a87da19 Mon Sep 17 00:00:00 2001 From: jif-oai Date: Fri, 9 Jan 2026 17:18:42 +0000 Subject: [PATCH] nit: rename to analytics_enabled (#8978) --- codex-rs/app-server/src/lib.rs | 4 ++-- codex-rs/core/src/config/mod.rs | 17 ++++++++--------- codex-rs/core/src/otel_init.rs | 6 +++++- codex-rs/exec/src/lib.rs | 2 +- codex-rs/tui/src/lib.rs | 2 +- codex-rs/tui2/src/lib.rs | 2 +- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/codex-rs/app-server/src/lib.rs b/codex-rs/app-server/src/lib.rs index 68663a991d..a2d14bf7dc 100644 --- a/codex-rs/app-server/src/lib.rs +++ b/codex-rs/app-server/src/lib.rs @@ -92,8 +92,8 @@ pub async fn run_main( let feedback = CodexFeedback::new(); - let otel = - codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION")).map_err(|e| { + let otel = codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION"), false) + .map_err(|e| { std::io::Error::new( ErrorKind::InvalidData, format!("error loading otel config: {e}"), diff --git a/codex-rs/core/src/config/mod.rs b/codex-rs/core/src/config/mod.rs index 668d205ccc..22fcbfd647 100644 --- a/codex-rs/core/src/config/mod.rs +++ b/codex-rs/core/src/config/mod.rs @@ -353,8 +353,8 @@ pub struct Config { pub disable_paste_burst: bool, /// When `false`, disables analytics across Codex product surfaces in this machine. - /// Defaults to `true`. - pub analytics: bool, + /// Voluntarily left as Optional because the default value might depend on the client. + pub analytics_enabled: Option, /// When `false`, disables feedback collection across Codex product surfaces. /// Defaults to `true`. @@ -1405,12 +1405,11 @@ impl Config { notices: cfg.notice.unwrap_or_default(), check_for_update_on_startup, disable_paste_burst: cfg.disable_paste_burst.unwrap_or(false), - analytics: config_profile + analytics_enabled: config_profile .analytics .as_ref() .and_then(|a| a.enabled) - .or(cfg.analytics.as_ref().and_then(|a| a.enabled)) - .unwrap_or(true), + .or(cfg.analytics.as_ref().and_then(|a| a.enabled)), feedback_enabled: cfg .feedback .as_ref() @@ -3266,7 +3265,7 @@ model_verbosity = "high" tui_notifications: Default::default(), animations: true, show_tooltips: true, - analytics: true, + analytics_enabled: Some(true), feedback_enabled: true, tui_scroll_events_per_tick: None, tui_scroll_wheel_lines: None, @@ -3351,7 +3350,7 @@ model_verbosity = "high" tui_notifications: Default::default(), animations: true, show_tooltips: true, - analytics: true, + analytics_enabled: Some(true), feedback_enabled: true, tui_scroll_events_per_tick: None, tui_scroll_wheel_lines: None, @@ -3451,7 +3450,7 @@ model_verbosity = "high" tui_notifications: Default::default(), animations: true, show_tooltips: true, - analytics: false, + analytics_enabled: Some(false), feedback_enabled: true, tui_scroll_events_per_tick: None, tui_scroll_wheel_lines: None, @@ -3537,7 +3536,7 @@ model_verbosity = "high" tui_notifications: Default::default(), animations: true, show_tooltips: true, - analytics: true, + analytics_enabled: Some(true), feedback_enabled: true, tui_scroll_events_per_tick: None, tui_scroll_wheel_lines: None, diff --git a/codex-rs/core/src/otel_init.rs b/codex-rs/core/src/otel_init.rs index 5ba714959c..9a05a29b95 100644 --- a/codex-rs/core/src/otel_init.rs +++ b/codex-rs/core/src/otel_init.rs @@ -15,6 +15,7 @@ use std::error::Error; pub fn build_provider( config: &Config, service_version: &str, + default_analytics_enabled: bool, ) -> Result, Box> { let to_otel_exporter = |kind: &Kind| match kind { Kind::None => OtelExporter::None, @@ -64,7 +65,10 @@ pub fn build_provider( let exporter = to_otel_exporter(&config.otel.exporter); let trace_exporter = to_otel_exporter(&config.otel.trace_exporter); - let metrics_exporter = if config.analytics { + let metrics_exporter = if config + .analytics_enabled + .unwrap_or(default_analytics_enabled) + { to_otel_exporter(&config.otel.metrics_exporter) } else { OtelExporter::None diff --git a/codex-rs/exec/src/lib.rs b/codex-rs/exec/src/lib.rs index 44ce1d6e2b..da3389c46a 100644 --- a/codex-rs/exec/src/lib.rs +++ b/codex-rs/exec/src/lib.rs @@ -223,7 +223,7 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option) -> any std::process::exit(1); } - let otel = codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION")); + let otel = codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION"), false); #[allow(clippy::print_stderr)] let otel = match otel { diff --git a/codex-rs/tui/src/lib.rs b/codex-rs/tui/src/lib.rs index f4e5e771fc..5855cfb71d 100644 --- a/codex-rs/tui/src/lib.rs +++ b/codex-rs/tui/src/lib.rs @@ -298,7 +298,7 @@ pub async fn run_main( ensure_oss_provider_ready(provider_id, &config).await?; } - let otel = codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION")); + let otel = codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION"), true); #[allow(clippy::print_stderr)] let otel = match otel { diff --git a/codex-rs/tui2/src/lib.rs b/codex-rs/tui2/src/lib.rs index ac062cf667..ee4d4d5d5e 100644 --- a/codex-rs/tui2/src/lib.rs +++ b/codex-rs/tui2/src/lib.rs @@ -313,7 +313,7 @@ pub async fn run_main( ensure_oss_provider_ready(provider_id, &config).await?; } - let otel = codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION")); + let otel = codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION"), true); #[allow(clippy::print_stderr)] let otel = match otel {