mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
Record actual Responses endpoints in tracing spans (#40906)
## Why Responses-compatible requests can use routes other than `/responses`, but their tracing spans reported the default route regardless of the selected endpoint. ## What changed - Populate `api.path` from the selected `ResponsesEndpoint` for HTTP and WebSocket requests. - Retain the endpoint on WebSocket connections so stream-request spans report the same route as connection spans. GitOrigin-RevId: 349eca94b27d4cc3a1adde8b257313506bdaf0f4
This commit is contained in:
@@ -1416,7 +1416,7 @@ impl ModelClientSession {
|
||||
provider = %self.client.state.provider.info().name,
|
||||
wire_api = %self.client.state.provider.info().wire_api,
|
||||
transport = "responses_websocket",
|
||||
api.path = "responses",
|
||||
api.path = params.endpoint.path(),
|
||||
turn.has_metadata_header = params.responses_metadata.has_turn_metadata()
|
||||
)
|
||||
)]
|
||||
@@ -1504,7 +1504,7 @@ impl ModelClientSession {
|
||||
wire_api = %self.client.state.provider.info().wire_api,
|
||||
transport = "responses_http",
|
||||
http.method = "POST",
|
||||
api.path = "responses",
|
||||
api.path = tracing::field::Empty,
|
||||
turn.has_metadata_header = responses_metadata.has_turn_metadata()
|
||||
)
|
||||
)]
|
||||
@@ -1530,6 +1530,7 @@ impl ModelClientSession {
|
||||
let endpoint = self
|
||||
.client
|
||||
.responses_endpoint(client_setup.auth.as_ref(), &model_info.slug);
|
||||
tracing::Span::current().record("api.path", endpoint.path());
|
||||
let transport = self
|
||||
.client
|
||||
.build_api_transport(&client_setup.api_provider, endpoint.path())?;
|
||||
@@ -1657,7 +1658,7 @@ impl ModelClientSession {
|
||||
model = %model_info.slug,
|
||||
wire_api = %self.client.state.provider.info().wire_api,
|
||||
transport = "responses_websocket",
|
||||
api.path = "responses",
|
||||
api.path = tracing::field::Empty,
|
||||
turn.has_metadata_header = responses_metadata.has_turn_metadata(),
|
||||
websocket.warmup = warmup
|
||||
)
|
||||
@@ -1688,6 +1689,7 @@ impl ModelClientSession {
|
||||
let endpoint = self
|
||||
.client
|
||||
.responses_endpoint(client_setup.auth.as_ref(), &model_info.slug);
|
||||
tracing::Span::current().record("api.path", endpoint.path());
|
||||
let request_auth_context = AuthRequestTelemetryContext::new(
|
||||
client_setup.auth.as_ref().map(CodexAuth::auth_mode),
|
||||
client_setup.api_auth.as_ref(),
|
||||
|
||||
Reference in New Issue
Block a user