mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
3b22498f69
## Summary - Record bounded duration and outcome metrics for remote environment registration and Noise rendezvous connection attempts. - Count reconnects by bounded reason: disconnect, connection failure, or rejected registration. - Trace registration at the owning client boundary without exporting raw environment or registration identifiers. - Replace the stale pre-Noise WebSocket observability design with the current remote transport model. ## Stack Review and land this stack in order: 1. #27466 — trace exec-server JSON-RPC requests 2. #27467 — record bounded connection, request, and process lifecycle metrics 3. #27470 — observe remote registration and Noise rendezvous lifecycle **(this PR)** ## Validation - `just test -p codex-exec-server --lib` (149 passed) - `just test -p codex-cli --test exec_server` (4 passed) - `just argument-comment-lint` - `just bazel-lock-check` - `just fix -p codex-exec-server -p codex-cli` - `just fmt`
25 lines
681 B
Rust
25 lines
681 B
Rust
use reqwest::header::HeaderMap;
|
|
use reqwest::header::HeaderValue;
|
|
|
|
pub(crate) fn current_trace_context_headers() -> HeaderMap {
|
|
let mut headers = HeaderMap::new();
|
|
let Some(trace) = codex_otel::current_span_w3c_trace_context() else {
|
|
return headers;
|
|
};
|
|
if let Some(traceparent) = trace.traceparent
|
|
&& let Ok(value) = HeaderValue::try_from(traceparent)
|
|
{
|
|
headers.insert("traceparent", value);
|
|
}
|
|
if let Some(tracestate) = trace.tracestate
|
|
&& let Ok(value) = HeaderValue::try_from(tracestate)
|
|
{
|
|
headers.insert("tracestate", value);
|
|
}
|
|
headers
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "trace_context_tests.rs"]
|
|
mod tests;
|