mirror of
https://github.com/openai/codex.git
synced 2026-11-10 08:43:33 +00:00
Make tool-result telemetry limits configurable (#39779)
## What changed - Add `otel.tool_result.max_bytes`, defaulting to 2048 bytes, to control the text included in `codex.tool_result` logs independently of model-visible output limits. - Apply truncation centrally when emitting telemetry, preserve UTF-8 boundaries, and report whether the logged output was truncated. - Record typed tool names and namespaces, agent names, and process-local result sequence numbers while keeping tool arguments and output out of trace events. ## Testing - Cover configuration propagation, UTF-8-safe truncation, raw tool-output logging, and log/trace event routing and fields. GitOrigin-RevId: 89ca76e55f1a09b729e7770ce01f2e4d98f9a22d
This commit is contained in:
1 parent
5663754f62
commit
854cbb2fd4
39 files changed
+583
-310
No files matched your search
@@ -9554,6 +9554,7 @@ async fn trace_exporter_defaults_to_none_when_log_exporter_is_set() -> std::io::
|
||||
let fixture = create_test_fixture()?;
|
||||
let mut cfg = fixture.cfg.clone();
|
||||
cfg.otel = Some(OtelConfigToml {
|
||||
tool_result: toml::from_str("max_bytes = 8192").expect("tool-result logging config"),
|
||||
exporter: Some(OtelExporterKind::OtlpHttp {
|
||||
endpoint: "http://localhost:14318/v1/logs".to_string(),
|
||||
headers: HashMap::new(),
|
||||
@@ -9574,6 +9575,7 @@ async fn trace_exporter_defaults_to_none_when_log_exporter_is_set() -> std::io::
|
||||
)
|
||||
.await?;
|
||||
|
||||
assert_eq!(config.otel.tool_result.max_bytes, 8192);
|
||||
assert!(matches!(
|
||||
config.otel.exporter,
|
||||
OtelExporterKind::OtlpHttp { .. }
|
||||
|
||||
@@ -26,6 +26,7 @@ pub(crate) fn resolve_config(
|
||||
let tracestate = resolve_tracestate(config.tracestate, startup_warnings);
|
||||
|
||||
OtelConfig {
|
||||
tool_result: config.tool_result,
|
||||
log_user_prompt,
|
||||
environment,
|
||||
exporter,
|
||||
|
||||
Reference in new issue
Block a user