vm-repair: add resource-shape telemetry dimensions - #10312
Conversation
|
Hi Edwin Bernal Microsoft (@EdwinBernal1), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Source VM disk_controller_type telemetry can remain None on older SDKs because it bypasses the existing fallback helper, reducing correctness/completeness of the new dimension.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the vm-repair Azure CLI extension to enrich telemetry with VM “resource shape” dimensions (OS family, VM size, disk controller types, Hyper-V generation) and corrects az vm repair run telemetry so it emits a single event per invocation.
Changes:
- Add resource-shape telemetry properties to all vm-repair telemetry event types.
- Fix duplicate telemetry emission for
az vm repair runby making the destructor telemetry path mutually exclusive. - Add unit tests validating the presence/defaults of the new dimensions and the single-event behavior.
File summaries
| File | Description |
|---|---|
| src/vm-repair/setup.py | Bumps extension version to 2.4.0. |
| src/vm-repair/HISTORY.rst | Documents telemetry dimension additions and the run double-event fix. |
| src/vm-repair/azext_vm_repair/tests/latest/test_telemetry_dimensions.py | Adds tests for new telemetry dimensions and single-event emission. |
| src/vm-repair/azext_vm_repair/telemetry.py | Adds resource-shape properties and threads them through telemetry helpers. |
| src/vm-repair/azext_vm_repair/custom.py | Populates telemetry resource context from source/repair VMs without impacting command success. |
| src/vm-repair/azext_vm_repair/command_helper_class.py | Stores resource context on the command helper and includes it in emitted telemetry. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Addresses PR review: _set_source_resource_context read storage_profile.disk_controller_type directly, so the dimension stayed None on older compute SDKs that do not model the field. It now goes through _fetch_source_disk_controller_type, which falls back to an ARM query, and create fetches the controller once instead of twice.
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
[Release] Update index.json for extension [ vm-repair-2.4.1 ] : https://dev.azure.com/msazure/One/_build/results?buildId=180458616&view=results |
🤖 PR Validation — ️✔️ All clear
Related command
az vm repair create,az vm repair run,az vm repair restore, andaz vm repair repair-and-restoreRequested by / source
NVMe-PR-Extension.mdType
Changes
azext_vm_repair/telemetry.pyos_family,vm_size,disk_controller_type,repair_vm_disk_controller_type, andhyperv_generationto generic, run-specific, and repair-and-restore telemetry events.azext_vm_repair/command_helper_class.pyset_resource_contextsetter withNonedefaults.if/elif/else, preventingvm repair runfrom also emitting a generic event.azext_vm_repair/custom.pyazext_vm_repair/tests/latest/test_telemetry_dimensions.pyNone.vm repair runemits exactly once.setup.py/HISTORY.rstVersion & changelog
setup.pyVERSION: 2.3.2 → 2.4.0HISTORY.rsttop entry added: yesThis is a minor version bump because the PR adds a backward-compatible telemetry capability and schema dimensions. Version 2.3.3 would indicate a patch-only bug fix, but this PR does more than correct duplicate events: it adds five new observable fields and resource-context collection across command paths. No command-line surface is broken.
Testing
origin/main:test_run_command_emits_oncefails because_track_command_telemetryis called once in addition to run telemetry.git diff --check: passed.azdev style vm-repair: passed (Pylint and Flake8).azdev linter vm-repair: passed.python scripts/ci/test_index.py -q: passed (9 tests, 2 skipped).azdev test vm-repair: blocked before test discovery by localaz cloud showlaunch failure (WinError 2). The direct extension unit suite above passed.General Guidelines
azdev style vm-repairlocally?python scripts/ci/test_index.py -qlocally?The “For new extensions” checklist does not apply because
vm-repairis an existing extension.About Extension Publish
Only
setup.pyandHISTORY.rstwere updated for release metadata.src/index.jsonwas not modified; the publication pipeline will create the index update after merge.N3 measurement
Pending. Existing telemetry has no disk-controller dimension, so retrospective NVMe volume cannot be measured directly. The N3 report must deduplicate historical run events and present any affected-volume estimate as an upper bound rather than an NVMe count.
Privacy review
The five new values are resource shape only:
linuxorwindowsSCSIorNVMewhen availableSCSIorNVMewhen availableV1orV2when availableThe new dimensions do not include VM names, resource-group names, disk names, resource IDs, credentials, tags, script arguments, or script output. Formal privacy sign-off remains required before merge.
Security review
command_helper.__del__.Cross-repo impact
No
repair-script-libraryrun-id, script, ormap.jsoncontract is changed by this PR. The companion script-library work is separate.Backward compatibility
Nonerather than causing command failure.vm repair runcounts because duplicate events are removed.