Files
codex/codex-rs/otel/Cargo.toml
T
xli-oai e6da6fd7c7 Add opt-in OTLP logging for final agent responses (#47649)
## What changed

Add `otel.log_agent_responses`, disabled by default and requiring an OTLP HTTP or gRPC log exporter. Emit `codex.agent_response` for completed `final_answer` messages from main agents and spawned task agents, with session, turn, item, and available parent/root attribution.

Strip memory citations from exported text, preserve the stored answer, and cap responses at 64 KiB on a UTF-8 character boundary. Include the original byte length and a truncation flag, and suppress duplicate item completions within each turn. Exclude commentary and non-task agents.

## Testing

Extend configuration tests for default-off and explicit opt-in behavior, the agent execution test for main/subagent response attribution, and the log-buffer test for response-event exclusion.

GitOrigin-RevId: eacda1150de2e6bac2c667d71b57214b0a086f1a
2026-09-23 20:07:03 +00:00

76 lines
2.0 KiB
TOML

[package]
name = "codex-otel"
version.workspace = true
edition.workspace = true
license.workspace = true
[lib]
doctest = false
name = "codex_otel"
path = "src/lib.rs"
[lints]
workspace = true
[dependencies]
bytes = { workspace = true }
codex-http-client = { workspace = true }
opentelemetry-http = "0.31.0"
chrono = { workspace = true }
codex-utils-absolute-path = { workspace = true }
codex-utils-stream-parser = { workspace = true }
codex-utils-string = { workspace = true }
codex-api = { workspace = true }
codex-protocol = { workspace = true }
eventsource-stream = { workspace = true }
gethostname = { workspace = true }
opentelemetry = { workspace = true, features = ["logs", "metrics", "trace"] }
opentelemetry-appender-tracing = { workspace = true }
opentelemetry-otlp = { workspace = true, features = [
"grpc-tonic",
"http-proto",
"http-json",
"logs",
"metrics",
"trace",
"reqwest-blocking-client",
"reqwest-rustls",
"tls",
"tls-roots",
]}
opentelemetry-semantic-conventions = { workspace = true }
opentelemetry_sdk = { workspace = true, features = [
"experimental_trace_batch_span_processor_with_async_runtime",
"experimental_metrics_custom_reader",
"logs",
"metrics",
"rt-tokio",
"testing",
"trace",
] }
http = { workspace = true }
os_info = { workspace = true }
reqwest = { workspace = true, features = ["blocking", "rustls-tls"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
strum_macros = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tokio-tungstenite = { workspace = true }
tracing = { workspace = true }
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true }
[dev-dependencies]
opentelemetry_sdk = { workspace = true, features = [
"experimental_metrics_custom_reader",
"testing",
] }
pretty_assertions = { workspace = true }
[target.'cfg(unix)'.dev-dependencies]
libc = { workspace = true }
[target.'cfg(target_os = "linux")'.dev-dependencies]
seccompiler = { workspace = true }