nit: rename to analytics_enabled (#8978)

This commit is contained in:
jif-oai authored and GitHub committed 2026-01-09 17:18:42 +00:00
1 parent 5c380d5b1e
commit ed64804cb5
6 files changed
+18 -15

No files matched your search

+2 -2
View File
@@ -92,8 +92,8 @@ pub async fn run_main(
let feedback = CodexFeedback::new(); let feedback = CodexFeedback::new();
let otel = let otel = codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION"), false)
codex_core::otel_init::build_provider(&config, env!("CARGO_PKG_VERSION")).map_err(|e| { .map_err(|e| {
std::io::Error::new( std::io::Error::new(
ErrorKind::InvalidData, ErrorKind::InvalidData,
format!("error loading otel config: {e}"), format!("error loading otel config: {e}"),
+8 -9
View File
@@ -353,8 +353,8 @@ pub struct Config {
pub disable_paste_burst: bool, pub disable_paste_burst: bool,
/// When `false`, disables analytics across Codex product surfaces in this machine. /// When `false`, disables analytics across Codex product surfaces in this machine.
/// Defaults to `true`. /// Voluntarily left as Optional because the default value might depend on the client.
pub analytics: bool, pub analytics_enabled: Option<bool>,
/// When `false`, disables feedback collection across Codex product surfaces. /// When `false`, disables feedback collection across Codex product surfaces.
/// Defaults to `true`. /// Defaults to `true`.
@@ -1405,12 +1405,11 @@ impl Config {
notices: cfg.notice.unwrap_or_default(), notices: cfg.notice.unwrap_or_default(),
check_for_update_on_startup, check_for_update_on_startup,
disable_paste_burst: cfg.disable_paste_burst.unwrap_or(false), disable_paste_burst: cfg.disable_paste_burst.unwrap_or(false),
analytics: config_profile analytics_enabled: config_profile
.analytics .analytics
.as_ref() .as_ref()
.and_then(|a| a.enabled) .and_then(|a| a.enabled)
.or(cfg.analytics.as_ref().and_then(|a| a.enabled)) .or(cfg.analytics.as_ref().and_then(|a| a.enabled)),
.unwrap_or(true),
feedback_enabled: cfg feedback_enabled: cfg
.feedback .feedback
.as_ref() .as_ref()
@@ -3266,7 +3265,7 @@ model_verbosity = "high"
tui_notifications: Default::default(), tui_notifications: Default::default(),
animations: true, animations: true,
show_tooltips: true, show_tooltips: true,
analytics: true, analytics_enabled: Some(true),
feedback_enabled: true, feedback_enabled: true,
tui_scroll_events_per_tick: None, tui_scroll_events_per_tick: None,
tui_scroll_wheel_lines: None, tui_scroll_wheel_lines: None,
@@ -3351,7 +3350,7 @@ model_verbosity = "high"
tui_notifications: Default::default(), tui_notifications: Default::default(),
animations: true, animations: true,
show_tooltips: true, show_tooltips: true,
analytics: true, analytics_enabled: Some(true),
feedback_enabled: true, feedback_enabled: true,
tui_scroll_events_per_tick: None, tui_scroll_events_per_tick: None,
tui_scroll_wheel_lines: None, tui_scroll_wheel_lines: None,
@@ -3451,7 +3450,7 @@ model_verbosity = "high"
tui_notifications: Default::default(), tui_notifications: Default::default(),
animations: true, animations: true,
show_tooltips: true, show_tooltips: true,
analytics: false, analytics_enabled: Some(false),
feedback_enabled: true, feedback_enabled: true,
tui_scroll_events_per_tick: None, tui_scroll_events_per_tick: None,
tui_scroll_wheel_lines: None, tui_scroll_wheel_lines: None,
@@ -3537,7 +3536,7 @@ model_verbosity = "high"
tui_notifications: Default::default(), tui_notifications: Default::default(),
animations: true, animations: true,
show_tooltips: true, show_tooltips: true,
analytics: true, analytics_enabled: Some(true),
feedback_enabled: true, feedback_enabled: true,
tui_scroll_events_per_tick: None, tui_scroll_events_per_tick: None,
tui_scroll_wheel_lines: None, tui_scroll_wheel_lines: None,
+5 -1
View File
@@ -15,6 +15,7 @@ use std::error::Error;
pub fn build_provider( pub fn build_provider(
config: &Config, config: &Config,
service_version: &str, service_version: &str,
default_analytics_enabled: bool,
) -> Result<Option<OtelProvider>, Box<dyn Error>> { ) -> Result<Option<OtelProvider>, Box<dyn Error>> {
let to_otel_exporter = |kind: &Kind| match kind { let to_otel_exporter = |kind: &Kind| match kind {
Kind::None => OtelExporter::None, Kind::None => OtelExporter::None,
@@ -64,7 +65,10 @@ pub fn build_provider(
let exporter = to_otel_exporter(&config.otel.exporter); let exporter = to_otel_exporter(&config.otel.exporter);
let trace_exporter = to_otel_exporter(&config.otel.trace_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) to_otel_exporter(&config.otel.metrics_exporter)
} else { } else {
OtelExporter::None OtelExporter::None
+1 -1
View File
@@ -223,7 +223,7 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
std::process::exit(1); 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)] #[allow(clippy::print_stderr)]
let otel = match otel { let otel = match otel {
+1 -1
View File
@@ -298,7 +298,7 @@ pub async fn run_main(
ensure_oss_provider_ready(provider_id, &config).await?; 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)] #[allow(clippy::print_stderr)]
let otel = match otel { let otel = match otel {
+1 -1
View File
@@ -313,7 +313,7 @@ pub async fn run_main(
ensure_oss_provider_ready(provider_id, &config).await?; 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)] #[allow(clippy::print_stderr)]
let otel = match otel { let otel = match otel {