feat: implement :perftrace and :help commands#632
Open
dlevy-msft-sql wants to merge 1 commit intomicrosoft:mainfrom
Open
feat: implement :perftrace and :help commands#632dlevy-msft-sql wants to merge 1 commit intomicrosoft:mainfrom
dlevy-msft-sql wants to merge 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
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.
This was referenced Jan 25, 2026
Closed
e7abfe7 to
4d25bf2
Compare
652c011 to
1175a7e
Compare
:perftrace redirects timing/statistics output to a file, stderr, or stdout. :help displays the list of available sqlcmd commands with usage. Both commands validate arguments and return appropriate errors.
1175a7e to
ccd2a31
Compare
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.
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