Skip to content

feat: show runtime metrics in console#10278

Merged
apanasenko-oai merged 1 commit intomainfrom
anton_panasenko_display_timing
Jan 31, 2026
Merged

feat: show runtime metrics in console#10278
apanasenko-oai merged 1 commit intomainfrom
anton_panasenko_display_timing

Conversation

@apanasenko-oai
Copy link
Collaborator

@apanasenko-oai apanasenko-oai commented Jan 31, 2026

Summary of changes:

  • Adds a new feature flag: runtime_metrics

    • Declared in core/src/features.rs
    • Added to core/config.schema.json
    • Wired into OTEL init in core/src/otel_init.rs
  • Enables on-demand runtime metric snapshots in OTEL

    • Adds runtime_metrics: bool to otel/src/config.rs
    • Enables experimental custom reader features in otel/Cargo.toml
    • Adds snapshot/reset/summary APIs in:
      • otel/src/lib.rs
      • otel/src/metrics/client.rs
      • otel/src/metrics/config.rs
      • otel/src/metrics/error.rs
  • Defines metric names and a runtime summary builder

    • New files:
      • otel/src/metrics/names.rs
      • otel/src/metrics/runtime_metrics.rs
    • Summarizes totals for:
      • Tool calls
      • API requests
      • SSE/streaming events
  • Instruments metrics collection in OTEL manager

    • otel/src/traces/otel_manager.rs now records:
      • API call counts + durations
      • SSE event counts + durations (success/failure)
      • Tool call metrics now use shared constants
  • Surfaces runtime metrics in the TUI

    • Resets runtime metrics at turn start in tui/src/chatwidget.rs
    • Displays metrics in the final separator line in tui/src/history_cell.rs
  • Adds tests

    • New OTEL tests:
      • otel/tests/suite/snapshot.rs
      • otel/tests/suite/runtime_summary.rs
    • New TUI test:
      • final_message_separator_includes_runtime_metrics in tui/src/history_cell.rs

Scope:

  • 19 files changed
  • ~652 insertions, 38 deletions
Screenshot 2026-01-30 at 4 11 34 PM

@apanasenko-oai apanasenko-oai force-pushed the anton_panasenko_display_timing branch 2 times, most recently from 4590f75 to ec6b523 Compare January 31, 2026 00:23
@apanasenko-oai apanasenko-oai marked this pull request as ready for review January 31, 2026 00:24
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 1893 to 1897
let runtime_metrics = if self.config.features.enabled(Feature::RuntimeMetrics) {
self.otel_manager.runtime_metrics_summary()
} else {
None
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wiltzius-openai I copied your approach to show current snapshot, tell me if you want something else.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this to some other file? history cell is huge

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm agree with you directionally, but splitting history cell is huge undertaking out of scope for this changes.

@apanasenko-oai apanasenko-oai force-pushed the anton_panasenko_display_timing branch from ec6b523 to b51b635 Compare January 31, 2026 01:36
@wiltzius-openai
Copy link

thank you for doing this!

@apanasenko-oai apanasenko-oai force-pushed the anton_panasenko_display_timing branch from b51b635 to 70390db Compare January 31, 2026 06:04
@apanasenko-oai apanasenko-oai merged commit 8660ad6 into main Jan 31, 2026
32 checks passed
@apanasenko-oai apanasenko-oai deleted the anton_panasenko_display_timing branch January 31, 2026 06:20
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants