Specialize OpenTelemetry providers for HTTP traces and metrics (#62854)

## Why

The code-mode host exports traces over OTLP/HTTP, and the elevated Windows
Filtering Platform setup helper exports Statsig metrics. Both used the
general-purpose provider, which made exporter builders for unused signals
and transports reachable from those binaries.

## What changed

Add `OtelProvider::try_new_http_traces` for the code-mode host and
`OtelProvider::try_new_http_metrics` for the Windows setup helper. Select
exporter builders at compile time so each constructor reaches only the
builders it needs. Both constructors reject unsupported signals and gRPC
configuration. The metrics constructor also accepts Statsig.

## Testing

Add unit tests for unsupported signals and gRPC configuration. Exercise
the specialized constructors in the HTTP loopback tests for trace delivery
on a current-thread Tokio runtime and cumulative metrics export.

GitOrigin-RevId: 875916791f0176839764c51b5ab289d5dc45a4d2
This commit is contained in:
Charlie Marsh
2026-11-20 22:39:52 +00:00
committed by copyberry
parent 63598243af
commit 548dd628df
5 changed files with 112 additions and 25 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ fn main() -> anyhow::Result<()> {
}
fn build_trace_provider(endpoint: &str) -> anyhow::Result<OtelProvider> {
OtelProvider::try_new(&OtelSettings {
OtelProvider::try_new_http_traces(&OtelSettings {
headers_helper: None,
http_client_factory: codex_http_client::HttpClientFactory::new(
codex_http_client::OutboundProxyPolicy::ReqwestDefault,