feat: show runtime metrics in console#10278
Conversation
4590f75 to
ec6b523
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec6b523138
ℹ️ 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".
codex-rs/tui/src/chatwidget.rs
Outdated
| let runtime_metrics = if self.config.features.enabled(Feature::RuntimeMetrics) { | ||
| self.otel_manager.runtime_metrics_summary() | ||
| } else { | ||
| None | ||
| }; |
There was a problem hiding this comment.
Capture runtime metrics after stream completes
This snapshot is taken when the first streaming delta arrives (inside handle_streaming_delta), but SSE events continue throughout the rest of the stream. Because the summary is computed and rendered only at this point, the “Streams: … events” counts and durations will systematically under‑report for any response with multiple SSE events (which is the common case). Consider deferring the snapshot until after streaming finishes or updating the separator once the stream ends so the summary includes the full stream.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@wiltzius-openai I copied your approach to show current snapshot, tell me if you want something else.
There was a problem hiding this comment.
I think we do want the full stream, that wasn't intentional on my part. A little surprising, because in my branch the numbers did "add up" (i.e. the stream time + wait to start streaming time + tool call time equaled the total wallclock time of "working")...?
| } | ||
| } | ||
| } | ||
| impl HistoryCell for FinalMessageSeparator { |
There was a problem hiding this comment.
can we move this to some other file? history cell is huge
There was a problem hiding this comment.
I'm agree with you directionally, but splitting history cell is huge undertaking out of scope for this changes.
ec6b523 to
b51b635
Compare
|
thank you for doing this! |
b51b635 to
70390db
Compare
Summary of changes:
Adds a new feature flag: runtime_metrics
Enables on-demand runtime metric snapshots in OTEL
Defines metric names and a runtime summary builder
Instruments metrics collection in OTEL manager
Surfaces runtime metrics in the TUI
Adds tests
Scope: