Keep tool-call metrics out of Statsig exports (#36049)

## What changed

- Treat `codex.tool.call` and `codex.tool.call.duration_ms` as runtime-only metrics when using the built-in Statsig exporter.
- Continue exporting both metrics through explicitly configured OTLP exporters.

## Testing

- Verify the Statsig configuration omits the tool-call metrics while retaining unrelated metrics.
- Extend the OTLP HTTP loopback test to cover the tool-call counter and duration histogram.

GitOrigin-RevId: 46dd2642063b34e9a4c69b67d58b45721609fcf2
This commit is contained in:
pakrym-oai authored and copyberry committed 2026-07-29 23:58:10 +00:00
1 parent 410c22b30e
commit 7b93b3bf9c
4 files changed
+75 -1

No files matched your search

@@ -186,6 +186,12 @@ fn otlp_http_exporter_sends_metrics_to_collector() -> Result<()> {
))?;
metrics.counter("codex.turns", /*inc*/ 1, &[("source", "test")])?;
metrics.counter("codex.tool.call", /*inc*/ 1, &[("tool", "test")])?;
metrics.record_duration(
"codex.tool.call.duration_ms",
Duration::from_millis(42),
&[("tool", "test")],
)?;
metrics.gauge_with_description(
"codex.active",
"Number of active Codex operations.",
@@ -221,6 +227,16 @@ fn otlp_http_exporter_sends_metrics_to_collector() -> Result<()> {
"expected gauge not found; body prefix: {}",
&body.chars().take(2000).collect::<String>()
);
assert!(
body.contains("\"codex.tool.call\""),
"expected tool-call counter not found; body prefix: {}",
&body.chars().take(2000).collect::<String>()
);
assert!(
body.contains("\"codex.tool.call.duration_ms\""),
"expected tool-call duration not found; body prefix: {}",
&body.chars().take(2000).collect::<String>()
);
assert!(
body.contains("component") && body.contains("test"),
"expected gauge tag not found; body prefix: {}",