Skip to content

vm-repair: add resource-shape telemetry dimensions - #10312

Merged
Julie Zhu (yanzhudd) merged 2 commits into
Azure:mainfrom
EdwinBernal1:edwin/vmrepair-scenario-telemetry
Sep 10, 2026
Merged

vm-repair: add resource-shape telemetry dimensions#10312
Julie Zhu (yanzhudd) merged 2 commits into
Azure:mainfrom
EdwinBernal1:edwin/vmrepair-scenario-telemetry

Conversation

@EdwinBernal1

@EdwinBernal1 Edwin Bernal Microsoft (EdwinBernal1) commented Sep 8, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes
️✔️ None

Related command

az vm repair create, az vm repair run, az vm repair restore, and az vm repair repair-and-restore

Requested by / source

  • Feature 37971694
  • Requested by Bila / Gabriela Limoli
  • Implementation plan: NVMe-PR-Extension.md

Type

  • Feature (minor)
  • Bug fix
  • Breaking change
  • Documentation only

Changes

  • azext_vm_repair/telemetry.py
    • Adds os_family, vm_size, disk_controller_type, repair_vm_disk_controller_type, and hyperv_generation to generic, run-specific, and repair-and-restore telemetry events.
  • azext_vm_repair/command_helper_class.py
    • Adds a plain set_resource_context setter with None defaults.
    • Passes resource context through all telemetry event paths.
    • Changes telemetry dispatch to if / elif / else, preventing vm repair run from also emitting a generic event.
  • azext_vm_repair/custom.py
    • Populates resource context in create, run, restore, and repair-and-restore paths.
    • Keeps telemetry-only enrichment non-fatal and outside the destructor.
    • Records the controller selected for the repair VM and, where available, the actual controller reported by an existing repair VM.
  • azext_vm_repair/tests/latest/test_telemetry_dimensions.py
    • Verifies all dimensions are emitted by all three telemetry functions.
    • Verifies dimensions default to None.
    • Verifies resource-shape dimensions exclude VM, resource-group, and disk identity.
    • Adds a regression test proving vm repair run emits exactly once.
  • setup.py / HISTORY.rst
    • Bumps 2.3.2 to 2.4.0 and documents the metrics discontinuity.

Version & changelog

  • setup.py VERSION: 2.3.2 → 2.4.0
  • HISTORY.rst top entry added: yes
  • Release metadata explicitly approved before commit.

This 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

  • Regression proof against origin/main: test_run_command_emits_once fails because _track_command_telemetry is called once in addition to run telemetry.
  • Branch result: the same regression test passes.
  • Unit suite: 70 tests passed, 35 live-only tests skipped.
  • Focused telemetry/controller/no-cleanup suite: 28 tests passed.
  • Intended-file git diff --check: passed.
  • VS Code diagnostics: no errors in changed source and test files.
  • 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 local az cloud show launch failure (WinError 2). The direct extension unit suite above passed.
  • Live Azure tests: not run.

General Guidelines

  • Have you run azdev style vm-repair locally?
  • Have you run python scripts/ci/test_index.py -q locally?
  • My extension version conforms to the Extension version schema.

The “For new extensions” checklist does not apply because vm-repair is an existing extension.

About Extension Publish

Only setup.py and HISTORY.rst were updated for release metadata. src/index.json was 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:

  • OS family: linux or windows
  • VM size/SKU
  • Source disk controller: SCSI or NVMe when available
  • Repair VM disk controller: SCSI or NVMe when available
  • Hyper-V generation: V1 or V2 when available

The 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

  • No new shell command construction from untrusted input.
  • No credentials or secrets added to telemetry.
  • No network work is performed from command_helper.__del__.
  • Telemetry enrichment failures are caught and logged at debug level so they do not change repair command success or failure.

Cross-repo impact

No repair-script-library run-id, script, or map.json contract is changed by this PR. The companion script-library work is separate.

Backward compatibility

  • No command names, parameters, defaults, or repair behavior changed.
  • Missing resource context is emitted as None rather than causing command failure.
  • Dashboard trends across 2.4.0 will show an apparent drop in vm repair run counts because duplicate events are removed.

Copilot AI lite review requested due to automatic review settings September 8, 2026 16:33
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Edwin Bernal Microsoft (@EdwinBernal1),
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 run by 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.

Comment thread src/vm-repair/azext_vm_repair/custom.py Outdated
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
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.
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@yanzhudd
Julie Zhu (yanzhudd) merged commit 0962c56 into Azure:main Sep 10, 2026
24 checks passed
@azclibot

Copy link
Copy Markdown
Collaborator

[Release] Update index.json for extension [ vm-repair-2.4.1 ] : https://dev.azure.com/msazure/One/_build/results?buildId=180458616&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants