mirror of
https://github.com/openai/codex.git
synced 2026-11-07 20:30:33 +00:00
Add OpenTelemetry tracing to the code-mode host (#40760)
## What changed - Add `--otel-trace-exporter` for sending OTLP/HTTP JSON traces directly to an exporter. - Add the mutually exclusive `--otel-trace-listen` option for streaming raw OTLP trace batches over a trace-only WebSocket, backed by a loopback OTLP receiver. - Instrument host startup, transport requests, and gRPC operations with request, session, execution, cell, wait, and tool-call identifiers where available. - Flush the trace provider with a bounded timeout during shutdown. GitOrigin-RevId: 4dcdb2bc3b15166dccd5041fb875caea74f3f6fe
This commit is contained in:
@@ -43,6 +43,12 @@ impl GrpcCodeModeHost {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(
|
||||
name = "code_mode_host.grpc.open_session",
|
||||
level = "info",
|
||||
skip_all,
|
||||
fields(otel.name = "code_mode_host.grpc.open_session")
|
||||
)]
|
||||
async fn open_session_request(
|
||||
&self,
|
||||
request: proto::OpenSessionRequest,
|
||||
@@ -52,6 +58,15 @@ impl GrpcCodeModeHost {
|
||||
Ok(Response::new(self.state.open_session(limits)?))
|
||||
}
|
||||
|
||||
#[tracing::instrument(
|
||||
name = "code_mode_host.grpc.close_session",
|
||||
level = "info",
|
||||
skip_all,
|
||||
fields(
|
||||
otel.name = "code_mode_host.grpc.close_session",
|
||||
session.id = %request.session_id,
|
||||
)
|
||||
)]
|
||||
async fn close_session_request(
|
||||
&self,
|
||||
request: proto::CloseSessionRequest,
|
||||
@@ -104,6 +119,17 @@ impl GrpcCodeModeHost {
|
||||
Ok(Response::new(proto::AcknowledgeNotificationResponse {}))
|
||||
}
|
||||
|
||||
#[tracing::instrument(
|
||||
name = "code_mode_host.grpc.execute",
|
||||
level = "info",
|
||||
skip_all,
|
||||
fields(
|
||||
otel.name = "code_mode_host.grpc.execute",
|
||||
session.id = %request.session_id,
|
||||
execution.id = %request.execution_id,
|
||||
call_id = %request.tool_call_id,
|
||||
)
|
||||
)]
|
||||
async fn execute_request(
|
||||
&self,
|
||||
request: proto::ExecuteRequest,
|
||||
@@ -171,6 +197,17 @@ impl GrpcCodeModeHost {
|
||||
Ok(Response::new(Box::pin(stream)))
|
||||
}
|
||||
|
||||
#[tracing::instrument(
|
||||
name = "code_mode_host.grpc.wait",
|
||||
level = "info",
|
||||
skip_all,
|
||||
fields(
|
||||
otel.name = "code_mode_host.grpc.wait",
|
||||
session.id = %request.session_id,
|
||||
cell.id = %request.cell_id,
|
||||
wait.id = %request.wait_id,
|
||||
)
|
||||
)]
|
||||
async fn wait_request(
|
||||
&self,
|
||||
request: proto::WaitRequest,
|
||||
|
||||
Reference in New Issue
Block a user