Skip to content

{Monitor} az monitor --help: Args-guided AAZ command tree loading for monitor module#33024

Open
ReaNAiveD wants to merge 13 commits intoAzure:devfrom
ReaNAiveD:optimize-monitor-aaz-loading
Open

{Monitor} az monitor --help: Args-guided AAZ command tree loading for monitor module#33024
ReaNAiveD wants to merge 13 commits intoAzure:devfrom
ReaNAiveD:optimize-monitor-aaz-loading

Conversation

@ReaNAiveD
Copy link
Member

@ReaNAiveD ReaNAiveD commented Mar 24, 2026

Related command

az monitor --help
az monitor foo bar --help

Description

Introduces an optimized AAZ command loader (load_aaz_command_table_args_guided) that navigates the package tree guided by CLI args instead of importing all command modules eagerly. Applied to the monitor module (151 AAZ commands). Also restructures customized command classes into an operations/latest/ tree to eliminate eager imports in commands.py.

Performance — Hyperfine (10 runs, 3 warmups, Windows)

Command dev optimized Improvement
az monitor --help 3,307 ms ± 44 1,273 ms ± 46 -2,034 ms (61.5%)
az monitor log-analytics workspace --help 3,408 ms ± 56 1,229 ms ± 16 -2,179 ms (63.9%)
az monitor metrics alert create --help 3,398 ms ± 18 1,398 ms ± 9 -2,000 ms (58.9%)
az monitor diagnostic-settings create --help 3,434 ms ± 43 1,404 ms ± 35 -2,030 ms (59.1%)

Performance — VizTracer Breakdown

az monitor --help

Function dev optimized Δ
AAZ loader 136.5 ms 70.9 ms -65.6 ms (48%)
commands.py load_command_table 2,233 ms 11.5 ms -2,222 ms (99.5%)
MonitorCommandsLoader.load_command_table 2,551 ms 335 ms -2,216 ms (86.9%)

az monitor diagnostic-settings create --help

Function dev optimized Δ
AAZ loader 178.4 ms 14.1 ms -164 ms (92%)
commands.py load_command_table 2,183 ms 10.4 ms -2,173 ms (99.5%)
MonitorCommandsLoader.load_command_table 2,612 ms 219 ms -2,393 ms (91.6%)

What changed

Core (_command.py)

  • New load_aaz_command_table_optimized function + helpers (_load_aaz_by_pkg, _get_pkg_children, _load_first_command, _try_import_module, _register_from_module)
  • Uses pkgutil.iter_modules() to match CLI args against subpackages, loading only the targeted subtree

AAZ __init__.py files (33 files)

  • Removed wildcard imports (from ._create import *) to prevent cascade imports

Direct module imports (14 files)

  • Changed all operations files to import from specific ._create, ._update modules instead of package-level imports

Operations tree (operations/latest/, 26 new files)

  • Customized AAZ command classes moved from flat operations/*.py files into a tree mirroring the AAZ structure
  • Each class sets table_transformer in __init__ (no more explicit command_table[...] = registrations)
  • Created __cmd_group.py for virtual subgroups (activity-log alert action-group, activity-log alert scope)
  • commands.py reduced from ~35 explicit registrations to zero

Lazy imports

  • Deferred antlr4, msrest.serialization, azure.mgmt.core.tools, azure.cli.command_modules.network.custom, grammar parsers from module-level to inside methods
  • Helper functions remain with lazy imports for non-cli-core dependencies
  • Two classes (AutoScaleProfileDelete, AutoScaleRuleCopy) bundled inside their wrapper functions

Config toggle & rollback

az config set monitor.use_legecy=true

Falls back to legecy loading — compatible with gutted __init__.py files.

Testing Guide

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 feature


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI review requested due to automatic review settings March 24, 2026 02:19
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 24, 2026

❌AzureCLI-FullTest
❌acr
❌latest
️✔️3.12
❌3.13
Type Test Case Error Message Line
Failed test_acr_connectedregistry_dedicated_endpoint_not_enabled The error message is too long, please check the pipeline log for details. azure/cli/command_modules/acr/tests/latest/test_acr_connectedregistry_commands.py:167
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link

Hi @ReaNAiveD,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 24, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 24, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Optimizes az monitor --help (and nested help) performance by introducing an args-guided AAZ command tree loader that imports only the relevant command subtree, and by restructuring the monitor module’s custom AAZ commands into an operations/latest/ package tree to avoid eager imports.

Changes:

  • Added load_aaz_command_table_args_guided (args-guided loader) to selectively import AAZ command modules/packages.
  • Refactored monitor custom AAZ commands into operations/latest/ and updated call sites to import leaf modules (e.g., ._create, ._update) instead of package-level __init__ wildcard imports.
  • Removed many AAZ __init__.py wildcard imports to prevent cascade imports and enable lazy loading.

Reviewed changes

Copilot reviewed 101 out of 101 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/azure-cli-core/azure/cli/core/aaz/_command.py Adds args-guided loader and helpers to trim imports to the requested command subtree.
src/azure-cli-core/azure/cli/core/aaz/init.py Exposes the new args-guided loader from azure.cli.core.aaz.
src/azure-cli/azure/cli/command_modules/monitor/init.py Switches monitor to args-guided loading for both aaz and operations trees with a config toggle.
src/azure-cli/azure/cli/command_modules/monitor/commands.py Removes explicit custom AAZ registrations in favor of auto-discovery from operations tree.
src/azure-cli/azure/cli/command_modules/monitor/custom.py Updates imports to use leaf AAZ modules (e.g., ._list) to avoid package-level eager imports.
src/azure-cli/azure/cli/command_modules/monitor/operations/private_link_scope.py Moves command classes out; keeps only helper validation with lazy imports.
src/azure-cli/azure/cli/command_modules/monitor/operations/monitor_clone_util.py Defers heavy imports and switches to leaf AAZ module imports.
src/azure-cli/azure/cli/command_modules/monitor/operations/metric_alert.py Removes moved class and defers heavy imports into function scope.
src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_workspace.py Removes moved classes; updates to leaf AAZ imports and adds lazy imports in functions.
src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_linked_storage_account.py Moves create class out; uses inner Update-derived classes with leaf AAZ imports.
src/azure-cli/azure/cli/command_modules/monitor/operations/general_operations.py Defers import of clone utilities to reduce module import cost.
src/azure-cli/azure/cli/command_modules/monitor/operations/diagnostics_settings.py Removes custom AAZ command classes; keeps shared helpers for latest ops tree wrappers.
src/azure-cli/azure/cli/command_modules/monitor/operations/autoscale_settings.py Removes custom AAZ classes; uses latest ops wrappers and defers imports.
src/azure-cli/azure/cli/command_modules/monitor/operations/activity_log_alerts.py Removes custom AAZ classes/registrations; keeps shared helpers and updates to leaf AAZ imports.
src/azure-cli/azure/cli/command_modules/monitor/operations/action_groups_identity.py Keeps only assign wrapper and switches to leaf AAZ module import.
src/azure-cli/azure/cli/command_modules/monitor/operations/action_groups.py Removes AAZ classes; keeps receiver parsing helper and defers ValidationError import.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/init.py Adds package marker for operations latest tree (loading root).
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/init.py Adds package marker for operations latest tree under monitor.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/private_link_scope/init.py Adds marker/noqa init to support lazy discovery.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/private_link_scope/_create.py Adds custom wrapper for private-link-scope create defaults.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/private_link_scope/private_endpoint_connection/init.py Adds marker/noqa init to support lazy discovery.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/private_link_scope/private_endpoint_connection/_update.py Adds custom wrappers for approve/reject + id validation + schema tweaks.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/metrics/init.py Adds marker package header for metrics subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/metrics/alert/init.py Adds marker/noqa init for metrics alert subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/metrics/alert/_update.py Moves MetricsAlertUpdate wrapper with deferred imports into operations latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/init.py Adds marker package header for log analytics subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/init.py Adds marker/noqa init for workspace subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/table/init.py Adds marker/noqa init for table subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/table/search_job/init.py Adds marker/noqa init for search-job subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/table/search_job/_cancel.py Moves search-job cancel validation wrapper to operations latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/linked_storage/init.py Adds marker/noqa init for linked-storage subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/linked_storage/_create.py Moves linked-storage create element format customization to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/data_export/init.py Adds marker/noqa init for data-export subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/data_export/_create.py Moves data-export destination validation/customization to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/data_export/_update.py Moves data-export destination validation/customization to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/init.py Adds marker/noqa init for diagnostic-settings subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/_create.py Moves diagnostic-settings create custom validation/arg wiring to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/_delete.py Adds wrapper to inject shared resource args and parameter update logic.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/_list.py Adds wrapper to inject shared resource args and parameter update logic.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/_show.py Adds wrapper to inject shared resource args and parameter update logic.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/_update.py Adds wrapper to inject shared resource args and parameter update logic.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/categories/init.py Adds marker/noqa init for categories subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/categories/_list.py Adds wrapper to inject shared resource args and parameter update logic.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/categories/_show.py Adds wrapper to inject shared resource args and parameter update logic.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/autoscale/init.py Adds marker/noqa init for autoscale subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/autoscale/_list.py Adds output adjustment wrapper for autoscale list.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/autoscale/_show.py Adds output adjustment wrapper for autoscale show.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/autoscale/_update.py Moves autoscale update wrapper (args schema + instance updates) to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/init.py Adds marker package header for activity-log subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/init.py Adds marker/noqa init for activity-log alert subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/_create.py Moves activity-log alert create wrapper + validation to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/_update.py Moves activity-log alert update wrapper + condition defaults to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/action_group/init.py Adds marker package header for action-group subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/action_group/__cmd_group.py Creates virtual subgroup header for action-group.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/action_group/_add.py Adds add action-group wrapper with strict mode and webhook property processing.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/action_group/_remove.py Adds remove action-group wrapper.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/scope/init.py Adds marker package header for scope subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/scope/__cmd_group.py Creates virtual subgroup header for scope.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/scope/_add.py Adds scope add wrapper with reset option.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/scope/_remove.py Adds scope remove wrapper.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/action_group/init.py Adds marker/noqa init for action-group subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/action_group/_create.py Moves action-group create wrapper + validation/table transformer to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/action_group/_update.py Moves action-group update wrapper + receiver add/remove logic to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/action_group/identity/init.py Adds marker/noqa init for identity subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/action_group/identity/_remove.py Moves identity remove wrapper to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/action_group/identity/_show.py Moves identity show wrapper to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/action_group/test_notifications/init.py Adds marker/noqa init for test-notifications subtree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/action_group/test_notifications/_create.py Moves test-notifications create wrapper + receiver parsing to latest tree.
src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/categories/_show.py Adds category show wrapper using shared diagnostics_settings helpers.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/account/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/action_group/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/action_group/identity/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/action_group/test_notifications/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/activity_log/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/activity_log/alert/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/autoscale/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/dashboard/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/diagnostic_settings/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/diagnostic_settings/categories/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/diagnostic_settings/subscription/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/cluster/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/cluster/identity/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/query_pack/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/query_pack/query/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/data_export/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/identity/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/linked_service/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/linked_storage/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/pack/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/saved_search/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/table/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/table/search_job/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_profiles/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/alert/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/private_link_scope/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/private_link_scope/private_endpoint_connection/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/private_link_scope/private_link_resource/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/private_link_scope/scoped_resource/init.py Removes wildcard imports to prevent cascade imports; keeps minimal init.
Comments suppressed due to low confidence (8)

src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/diagnostic_settings/_create.py:1

  • The error message references a flag name that doesn't match the argument defined earlier (--export-to-resource-specific). This will confuse users troubleshooting CLI usage. Update the message to mention the correct option name and clarify that --workspace is required when --export-to-resource-specific is set.
    src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/data_export/_create.py:1
  • Correct typo in help/error text: 'evenhug' should be 'event hub'.
    src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/log_analytics/workspace/data_export/_update.py:1
  • Correct typo in help/error text: 'evenhug' should be 'event hub'.
    src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/autoscale/_update.py:1
  • Typo in help text: 'numer' should be 'number'.
    src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/action_group/_remove.py:1
  • This is the action-group remove command, but the help text says 'to be added'. This is user-facing CLI help and should say 'to be removed' (or similar) to avoid misuse.
    src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/scope/_add.py:1
  • The scope add command's --reset help text references action groups/conditions, which appears unrelated to scopes. This should describe resetting scopes (e.g., removing existing scopes before adding the provided --scope values).
    src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/activity_log/alert/action_group/_add.py:1
  • Raising a plain ValueError here is likely to produce a less user-friendly CLI failure mode than an AzCLIError-derived exception. Consider raising ValidationError (or a more specific CLI error type) so the CLI formats the error consistently and avoids exposing a Python exception type to end users.
    src/azure-cli/azure/cli/command_modules/monitor/operations/latest/monitor/private_link_scope/private_endpoint_connection/_update.py:1
  • private_endpoint_connection/_update.py now contains wrappers for delete/show as well as update-derived approve/reject. This makes the file name misleading and increases future discovery/maintenance cost. Consider splitting wrappers into _delete.py, _show.py, and _update.py (and keeping approve/reject in _update.py), aligning file names with the command operation they customize.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +63 to +68
if use_optimized and args and args[0:1] == ['monitor']:
logger.warning(
"The monitor module is using optimized command loading for improved performance. "
"If you encounter any issues, you can disable this by running: "
"az config set %s.%s=false",
_OPTIMIZED_LOADING_CONFIG_SECTION, _OPTIMIZED_LOADING_CONFIG_KEY)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This will emit a warning for every az monitor ... invocation (not just --help), which may be noisy and could surprise users who treat warnings as actionable failures in automation logs. Consider reducing the level (e.g., info/debug), limiting it to help scenarios, or gating it behind a one-time marker (config/env) so it’s shown once per user/session.

Copilot uses AI. Check for mistakes.
@ReaNAiveD ReaNAiveD requested a review from VeryEarly as a code owner March 25, 2026 00:39
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.

3 participants