{Core} Add CommandPreserveCasing and CommandIndexRebuild telemetry properties for command rebuild analysis#32451
Conversation
️✔️AzureCLI-FullTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
Hi @DanielMicrosoft, |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
️✔️AzureCLI-BreakingChangeTest
|
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR adds two new telemetry properties to support command rebuild analysis: CommandPreserveCasing (preserving the original casing of user-entered commands) and CmdIdxRebuildTriggered (indicating whether command index rebuild was triggered during execution).
Key Changes
- Added
roughly_parse_command_with_casing()utility function to parse commands while preserving original casing, complementing the existingroughly_parse_command()function - Updated telemetry session to track two new properties for command rebuild analysis
- Added comprehensive unit tests for both the existing and new command parsing functions
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli-core/azure/cli/core/util.py | Added new roughly_parse_command_with_casing() function to extract command parts while preserving original user input casing |
| src/azure-cli-core/azure/cli/core/tests/test_util.py | Added comprehensive unit tests for both roughly_parse_command() and roughly_parse_command_with_casing(), including security tests to ensure sensitive flag values aren't captured |
| src/azure-cli-core/azure/cli/core/telemetry.py | Added two new telemetry properties (command_preserve_casing and cmd_idx_rebuild_triggered) with supporting functions to track command rebuild metrics |
| src/azure-cli-core/azure/cli/core/commands/init.py | Updated command execution to capture command with preserved casing early in the pipeline and pass it to telemetry tracking |
| src/azure-cli-core/azure/cli/core/init.py | Added telemetry tracking when module discovery triggers command index rebuild |
| .vscode/launch.json | Updated debug configuration to use debugpy type and removed deprecated debugOptions (appears unrelated to the PR's main purpose) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Do you think we might also need to set the case-sensitive command in the following place? azure-cli/src/azure-cli-core/azure/cli/core/extension/dynamic_install.py Lines 209 to 212 in b1f35f2 |
|
these two properties look very valuable! i only have a small suggestion regarding the naming—since azure-cli/src/azure-cli-core/azure/cli/core/telemetry.py Lines 163 to 164 in 00dee0d i.e., |
|
@necusjz I believe this can be approved/merged now, the changed property name is now whitelisted in GDPR. You can search an example using guid |
|
@DanielMicrosoft, Did these changes only impact telemetry? Is it possible to cause regression? |
Correct, only telemetry. |
Related command
Description
Adds telemetry for
commandpreservecasing(to capture the casing used in the command) andcmdidxrebuildtriggered(to track whether or not a command index rebuild occurred in the command invocation).ADO Task: https://msazure.visualstudio.com/One/_workitems/edit/35931568
Checklist:
helpcommand--helpcommandHelpcommand (does it case/re-build?)--Helpcommand (does it case/re-build?)--version(does it case/re-build?)--Versioncommand (does it case/re-build?)versioncommand (does it case/re-build?)Versioncommand (does it case/re-build?)az vm --helpaz VM --helpdynamic installpathTesting Guide
Use this branch to send commands and observe the resultant telemetry events in Kusto.
The
Propertiescolumn should have the properties"context.default.azurecli.commandpreservecasing"and"context.default.azurecli.cmdidxrebuildtriggered": "True"History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.