mirror of
https://github.com/openai/codex.git
synced 2026-04-30 01:16:54 +00:00
## Summary This is a structural cleanup of `codex-otel` to make the ownership boundaries a lot clearer. For example, previously it was quite confusing that `OtelManager` which emits log + trace event telemetry lived under `codex-rs/otel/src/traces/`. Also, there were two places that defined methods on OtelManager via `impl OtelManager` (`lib.rs` and `otel_manager.rs`). What changed: - move the `OtelProvider` implementation into `src/provider.rs` - move `OtelManager` and session-scoped event emission into `src/events/otel_manager.rs` - collapse the shared log/trace event helpers into `src/events/shared.rs` - pull target classification into `src/targets.rs` - move `traceparent_context_from_env()` into `src/trace_context.rs` - keep `src/otel_provider.rs` as a compatibility shim for existing imports - update the `codex-otel` README to reflect the new layout ## Why `lib.rs` and `otel_provider.rs` were doing too many different jobs at once: provider setup, export routing, trace-context helpers, and session event emission all lived together. This refactor separates those concerns without trying to change the behavior of the crate. The goal is to make future OTEL work easier to reason about and easier to review. ## Notes - no intended behavior change - `OtelManager` remains the session-scoped event emitter in this PR - the `otel_provider` shim keeps downstream churn low while the internals move around ## Validation - `just fmt` - `cargo test -p codex-otel` - `just fix -p codex-otel`
12 lines
447 B
Rust
12 lines
447 B
Rust
pub(crate) const OTEL_TARGET_PREFIX: &str = "codex_otel";
|
|
pub(crate) const OTEL_LOG_ONLY_TARGET: &str = "codex_otel.log_only";
|
|
pub(crate) const OTEL_TRACE_SAFE_TARGET: &str = "codex_otel.trace_safe";
|
|
|
|
pub(crate) fn is_log_export_target(target: &str) -> bool {
|
|
target.starts_with(OTEL_TARGET_PREFIX) && !is_trace_safe_target(target)
|
|
}
|
|
|
|
pub(crate) fn is_trace_safe_target(target: &str) -> bool {
|
|
target.starts_with(OTEL_TRACE_SAFE_TARGET)
|
|
}
|