mirror of
https://github.com/openai/codex.git
synced 2026-05-05 22:01:37 +03:00
otel: remove the last workspace crate feature (#16469)
## Why `codex-otel` still carried `disable-default-metrics-exporter`, which was the last remaining workspace crate feature. We are removing workspace crate features because they do not fit our current build model well: - our Bazel setup does not honor crate features today, which can let feature-gated issues go unnoticed - they create extra crate build permutations that we want to avoid For this case, the feature was only being used to keep the built-in Statsig metrics exporter off in test and debug-oriented contexts. This repo already treats `debug_assertions` as the practical proxy for that class of behavior, so OTEL should follow the same convention instead of keeping a dedicated crate feature alive. ## What changed - removed `disable-default-metrics-exporter` from `codex-rs/otel/Cargo.toml` - removed the `codex-otel` dev-dependency feature activation from `codex-rs/core/Cargo.toml` - changed `codex-rs/otel/src/config.rs` so the built-in `OtelExporter::Statsig` default resolves to `None` when `debug_assertions` is enabled, with a focused unit test covering that behavior - removed the final feature exceptions from `.github/scripts/verify_cargo_workspace_manifests.py`, so workspace crate features are now hard-banned instead of temporarily allowlisted - expanded the verifier error message to explain the Bazel mismatch and build-permutation cost behind that policy ## How tested - `python3 .github/scripts/verify_cargo_workspace_manifests.py` - `cargo test -p codex-otel` - `cargo test -p codex-core metrics_exporter_defaults_to_statsig_when_missing` - `cargo test -p codex-app-server app_server_default_analytics_` - `just bazel-lock-check`
This commit is contained in:
@@ -10,7 +10,11 @@ pub(crate) const STATSIG_API_KEY: &str = "client-MkRuleRQBd6qakfnDYqJVR9JuXcY57L
|
||||
pub(crate) fn resolve_exporter(exporter: &OtelExporter) -> OtelExporter {
|
||||
match exporter {
|
||||
OtelExporter::Statsig => {
|
||||
if cfg!(test) || cfg!(feature = "disable-default-metrics-exporter") {
|
||||
// Keep the built-in Statsig default off in debug builds so
|
||||
// incremental local development and test runs do not emit
|
||||
// best-effort OTEL traffic unless a test or binary opts into an
|
||||
// explicit exporter configuration.
|
||||
if cfg!(debug_assertions) {
|
||||
return OtelExporter::None;
|
||||
}
|
||||
|
||||
@@ -74,3 +78,17 @@ pub enum OtelExporter {
|
||||
tls: Option<OtelTlsConfig>,
|
||||
},
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::OtelExporter;
|
||||
use super::resolve_exporter;
|
||||
|
||||
#[test]
|
||||
fn statsig_default_metrics_exporter_is_disabled_in_debug_builds() {
|
||||
assert!(matches!(
|
||||
resolve_exporter(&OtelExporter::Statsig),
|
||||
OtelExporter::None
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user