refactor(gateway_logs): replace manual ASCII table with console.RenderTable#21216
Merged
refactor(gateway_logs): replace manual ASCII table with console.RenderTable#21216
Conversation
…erTable Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
March 16, 2026 12:07
View session
7 tasks
pelikhan
approved these changes
Mar 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors gateway metrics output to use console.RenderTable instead of manually building fixed-width Unicode tables, improving consistency and TTY-aware styling.
Changes:
- Replaced the “Server Usage” metrics table rendering with
console.RenderTable. - Replaced per-server “Tool Usage” verbose tables with
console.RenderTable. - Updated imports (removed
stringutil, addedstrconv) to support the new formatting approach.
Comments suppressed due to low confidence (1)
pkg/cli/gateway_logs.go:568
- Previously tool names were truncated (24 chars) to keep the per-server tool table width bounded. Passing
toolNamethrough unmodified can produce very wide tables for long tool identifiers. Consider truncating tool names before adding them totoolRows(or supporting max column widths inconsole.RenderTable).
toolRows = append(toolRows, []string{
toolName,
strconv.Itoa(tool.CallCount),
fmt.Sprintf("%.0fms", tool.AvgDuration),
fmt.Sprintf("%.0fms", tool.MaxDuration),
strconv.Itoa(tool.ErrorCount),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+527
to
+532
| serverRows = append(serverRows, []string{ | ||
| serverName, | ||
| strconv.Itoa(server.RequestCount), | ||
| strconv.Itoa(server.ToolCallCount), | ||
| fmt.Sprintf("%.0fms", avgTime), | ||
| strconv.Itoa(server.ErrorCount), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
renderGatewayMetricsTableinpkg/cli/gateway_logs.gobuilt tables manually using Unicode box-drawing characters and fixed-widthfmt.Fprintfcolumn alignment. Replaces both tables (server metrics and per-server tool details) withconsole.RenderTable, gaining TTY-aware rendering, adaptive colors, and consistent border styling.Changes
console.RenderTable(TableConfig{Title: "Server Usage", Headers: [...]})Titlestringutilimport — fixed-width truncation for manual column alignment no longer neededstrconvimport —strconv.Itoareplacesfmt.Sprintf("%d", ...)per linter (perfsprint)