mirror of
https://github.com/openai/codex.git
synced 2026-04-30 01:16:54 +00:00
chore(otel): rename OtelManager to SessionTelemetry (#13808)
## Summary This is a purely mechanical refactor of `OtelManager` -> `SessionTelemetry` to better convey what the struct is doing. No behavior change. ## Why `OtelManager` ended up sounding much broader than what this type actually does. It doesn't manage OTEL globally; it's the session-scoped telemetry surface for emitting log/trace events and recording metrics with consistent session metadata (`app_version`, `model`, `slug`, `originator`, etc.). `SessionTelemetry` is a more accurate name, and updating the call sites makes that boundary a lot easier to follow. ## Validation - `just fmt` - `cargo test -p codex-otel` - `cargo test -p codex-core`
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::harness::attributes_to_map;
|
||||
use crate::harness::build_metrics_with_defaults;
|
||||
use crate::harness::find_metric;
|
||||
use crate::harness::latest_metrics;
|
||||
use codex_otel::OtelManager;
|
||||
use codex_otel::SessionTelemetry;
|
||||
use codex_otel::TelemetryAuthMode;
|
||||
use codex_otel::metrics::Result;
|
||||
use codex_protocol::ThreadId;
|
||||
@@ -12,11 +12,11 @@ use opentelemetry_sdk::metrics::data::MetricData;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
// Ensures OtelManager attaches metadata tags when forwarding metrics.
|
||||
// Ensures SessionTelemetry attaches metadata tags when forwarding metrics.
|
||||
#[test]
|
||||
fn manager_attaches_metadata_tags_to_metrics() -> Result<()> {
|
||||
let (metrics, exporter) = build_metrics_with_defaults(&[("service", "codex-cli")])?;
|
||||
let manager = OtelManager::new(
|
||||
let manager = SessionTelemetry::new(
|
||||
ThreadId::new(),
|
||||
"gpt-5.1",
|
||||
"gpt-5.1",
|
||||
@@ -68,11 +68,11 @@ fn manager_attaches_metadata_tags_to_metrics() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Ensures metadata tagging can be disabled when recording via OtelManager.
|
||||
// Ensures metadata tagging can be disabled when recording via SessionTelemetry.
|
||||
#[test]
|
||||
fn manager_allows_disabling_metadata_tags() -> Result<()> {
|
||||
let (metrics, exporter) = build_metrics_with_defaults(&[])?;
|
||||
let manager = OtelManager::new(
|
||||
let manager = SessionTelemetry::new(
|
||||
ThreadId::new(),
|
||||
"gpt-4o",
|
||||
"gpt-4o",
|
||||
@@ -113,7 +113,7 @@ fn manager_allows_disabling_metadata_tags() -> Result<()> {
|
||||
#[test]
|
||||
fn manager_attaches_optional_service_name_tag() -> Result<()> {
|
||||
let (metrics, exporter) = build_metrics_with_defaults(&[])?;
|
||||
let manager = OtelManager::new(
|
||||
let manager = SessionTelemetry::new(
|
||||
ThreadId::new(),
|
||||
"gpt-5.1",
|
||||
"gpt-5.1",
|
||||
|
||||
Reference in New Issue
Block a user