[codex] Add minimal OpenTelemetry instrumentation#2
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 873668c498
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func (s *stream) Close() error { | ||
| if !s.done { | ||
| s.finish(context.Canceled) | ||
| } |
There was a problem hiding this comment.
Don't mark completed web streams as cancelled
When a web chat turn reaches response.completed, turnJob.run emits the terminal done event and returns immediately, so the deferred TurnStream.Close() closes the OpenResponses stream before the trailing SSE [DONE] frame is read. In that normal success path s.done is still false here, so finish(context.Canceled) records the openresponses.stream.consume span as an error/cancellation for successful web turns, corrupting the telemetry this change adds. Track the completed event (or let Close distinguish a completed response from an early abort) before recording cancellation.
Useful? React with 👍 / 👎.
Summary
Impact
Telemetry remains disabled unless OTLP env vars are configured. When enabled, traces and metrics export over OTLP/gRPC and avoid prompt text, response content, auth tokens, cookies, user/session/turn/message IDs, and other high-cardinality or sensitive values.
Validation