-
Notifications
You must be signed in to change notification settings - Fork 79
Implement :perftrace command #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add the :perftrace command to redirect performance statistics output to a file, stderr, or stdout. This works in conjunction with the -p flag to control where timing statistics are written. Syntax: :perftrace <filename>|stderr|stdout Changes: - Added stat writer field to Sqlcmd struct - Added GetStat/SetStat methods - Added PERFTRACE command with file/stdout/stderr support - Added tests for command parsing and functionality This improves compatibility with legacy ODBC sqlcmd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements the :perftrace command to redirect performance statistics output to a file, stderr, or stdout, working in conjunction with the -p flag from PR #631.
Changes:
- Added stat writer infrastructure with GetStat/SetStat methods following the established pattern for output/error writers
- Implemented PERFTRACE command supporting file paths, "stdout", and "stderr" with variable substitution
- Added comprehensive test coverage for the command functionality
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/sqlcmd/sqlcmd.go | Added stat field and GetStat()/SetStat() methods for managing performance statistics output writer |
| pkg/sqlcmd/commands.go | Registered PERFTRACE command and implemented perftraceCommand() function with file/stdout/stderr support |
| pkg/sqlcmd/commands_test.go | Added TestPerftraceCommand() with comprehensive test scenarios and added PERFTRACE parsing tests |
| README.md | Documented the :perftrace command with usage example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add the :help command to display available sqlcmd commands. This improves compatibility with legacy ODBC sqlcmd. Changes: - Added HELP command to command registry - Added helpCommand function with full command list - Added tests for command parsing and functionality - Updated README.md
- Remove :serverlist and :perftrace from help text - These commands are in separate PRs and not yet merged - Help text should only list commands that exist in this branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
- Fix regex pattern for consistency with other commands - Fix README path to use forward slashes for cross-platform - Add test cases for :PERFTRACE command parsing - Add :perftrace assertion in TestHelpCommand - Add TestPerftraceCommand for comprehensive testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Summary
Adds the
:perftracecommand to redirect performance statistics output to a file, stderr, or stdout. This works in conjunction with the-pflag (PR #631) to control where timing statistics are written.Syntax
Changes
statwriter field andGetStat/SetStatmethodsPERFTRACEcommand with file/stdout/stderr supportTesting
golangci-lint runpasses (pre-existing warnings only)Related
-pflag for print statistics