Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az --help causes a command index rebuild #27444

Closed
jessehouwing opened this issue Sep 21, 2023 · 8 comments
Closed

az --help causes a command index rebuild #27444

jessehouwing opened this issue Sep 21, 2023 · 8 comments
Assignees
Labels
AAD Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.
Milestone

Comments

@jessehouwing
Copy link

jessehouwing commented Sep 21, 2023

Describe the bug

When running az --help, the commandindex is always rebuilt, adding to the time taken to run the command.

Related command

az --help --debug`

Errors

cli.azure.cli.core: No module found from index for '['--help', '--debug']'
cli.azure.cli.core: Loading all modules and extensions

Issue script & Debug output

> az --help --debug

cli.knack.cli: Command arguments: ['--help', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
Enable VT mode.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x0177A538>, <function OutputProducer.on_global_arguments at 0x0197C778>, <function CLIQuery.on_global_arguments at 0x019983D0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: No module found from index for '['--help', '--debug']'
cli.azure.cli.core: Loading all modules and extensions
cli.azure.cli.core: Discovered command modules: ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'aro', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'config', 'configure', 'consumption', 'container', 'cosmosdb', 'databoxedge', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'identity', 'interactive', 'iot', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'marketplaceordering', 'monitor', 'mysql', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'resource', 'role', 'search', 'security', 'servicebus', 'serviceconnector', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'synapse', 'util', 'vm']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: acr                       0.129        34       144
cli.azure.cli.core: acs                       0.023         7        54
cli.azure.cli.core: advisor                   0.002         3         6
cli.azure.cli.core: ams                       0.017        22       100
cli.azure.cli.core: apim                      0.007        14        68
cli.azure.cli.core: appconfig                 0.004         9        47
cli.azure.cli.core: appservice                0.075        73       260
cli.azure.cli.core: aro                       0.013         1        10
cli.azure.cli.core: backup                    0.005        16        58
cli.azure.cli.core: batch                     0.030        34       102
cli.azure.cli.core: batchai                   0.005        10        30
cli.azure.cli.core: billing                   0.008        19        52
cli.azure.cli.core: botservice                0.005        12        42
cli.azure.cli.core: cdn                       0.006        39       133
cli.azure.cli.core: cloud                     0.003         1         7
cli.azure.cli.core: cognitiveservices         0.003        10        33
cli.azure.cli.core: config                    0.002         2         7
cli.azure.cli.core: configure                 0.002         2         5
cli.azure.cli.core: consumption               0.024         8         9
cli.azure.cli.core: container                 0.014         1        11
cli.azure.cli.core: cosmosdb                  0.015        58       192
cli.azure.cli.core: databoxedge               0.006         5        27
cli.azure.cli.core: dla                       0.004        23        62
cli.azure.cli.core: dls                       0.003         7        41
cli.azure.cli.core: dms                       0.003         3        22
cli.azure.cli.core: eventgrid                 0.005        25        96
cli.azure.cli.core: eventhubs                 0.018        13        20
cli.azure.cli.core: extension                 0.001         1         7
cli.azure.cli.core: feedback                  0.001         1         2
cli.azure.cli.core: find                      0.001         1         1
cli.azure.cli.core: hdinsight                 0.009         8        39
cli.azure.cli.core: identity                  0.003         2        11
cli.azure.cli.core: interactive               0.001         1         1
cli.azure.cli.core: iot                       0.101        19        82
cli.azure.cli.core: keyvault                  0.008        22       133
cli.azure.cli.core: kusto                     0.003         3        14
cli.azure.cli.core: lab                       0.005        11        34
cli.azure.cli.core: managedservices           0.003         3         8
cli.azure.cli.core: maps                      0.003         5        13
cli.azure.cli.core: marketplaceordering       0.004         1         2
cli.azure.cli.core: monitor                   0.058        22        69
cli.azure.cli.core: mysql                     0.190        14        49
cli.azure.cli.core: netappfiles               0.006        17        94
cli.azure.cli.core: network                   0.316       103       337
cli.azure.cli.core: policyinsights            0.015         9        17
cli.azure.cli.core: privatedns                0.024        14        60
cli.azure.cli.core: profile                   0.003         2         9
cli.azure.cli.core: rdbms                     0.022        44       185
cli.azure.cli.core: redis                     0.003         5        27
cli.azure.cli.core: relay                     0.029         7         8
cli.azure.cli.core: resource                  0.011        51       226
cli.azure.cli.core: role                      0.003        17        61
cli.azure.cli.core: search                    0.003         7        22
cli.azure.cli.core: security                  0.005        48       104
cli.azure.cli.core: servicebus                0.019        12        17
cli.azure.cli.core: serviceconnector          0.051        16       235
cli.azure.cli.core: servicefabric             0.017        27        76
cli.azure.cli.core: signalr                   0.004         8        30
cli.azure.cli.core: sql                       0.016        56       215
cli.azure.cli.core: sqlvm                     0.023         4        20
cli.azure.cli.core: storage                   0.035        58       272
cli.azure.cli.core: synapse                   0.013        54       246
cli.azure.cli.core: util                      0.003         3         7
cli.azure.cli.core: vm                        0.050        57       265
cli.azure.cli.core: Total (64)                1.493      1184      4636
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: azure-devops              0.083        60       192  C:\Users\JesseHouwing\.azure\cliextensions\azure-devops
cli.azure.cli.core: containerapp              0.034        31        95  C:\Users\JesseHouwing\.azure\cliextensions\containerapp
cli.azure.cli.core: init                      0.004         1         1  C:\Users\JesseHouwing\.azure\cliextensions\init
cli.azure.cli.core: Total (3)                 0.121        92       288
cli.azure.cli.core: Loaded 1262 groups, 4924 commands.
cli.azure.cli.core: Updated command index in 0.005 seconds.
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x03B296E8>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\JesseHouwing\.azure\commands\2023-09-21.15-35-57.unknown_command.33904.log'.
az_command_data_logger: command args: --help --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x03B53850>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x03B627C0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x03B629B8>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x04925190>]

Group
    az

Subgroups:
    account               : Manage Azure subscription information.
    acr                   : Manage private registries with Azure Container Registries.
    ad                    : Manage Azure Active Directory Graph entities needed for Role Based
                            Access Control.
    advisor               : Manage Azure Advisor.
    afd         [Preview] : Manage Azure Front Door Standard/Premium. For classical Azure
                            Front Door, please refer https://docs.microsoft.com/en-
                            us/cli/azure/network/front-door?view=azure-cli-latest.
    aks                   : Manage Azure Kubernetes Services.
    ams                   : Manage Azure Media Services resources.
    apim                  : Manage Azure API Management services.
    appconfig             : Manage App Configurations.
    appservice            : Manage App Service plans.
    aro                   : Manage Azure Red Hat OpenShift clusters.
    artifacts             : Manage Azure Artifacts.
    backup                : Manage Azure Backups.
    batch                 : Manage Azure Batch.
    bicep                 : Bicep CLI command group.
    billing               : Manage Azure Billing.
    boards                : Manage Azure Boards.
    bot                   : Manage Microsoft Azure Bot Service.
    cache                 : Commands to manage CLI objects cached using the `--defer` argument.
    capacity              : Manage capacity.
    cdn                   : Manage Azure Content Delivery Networks (CDNs).
    cloud                 : Manage registered Azure clouds.
    cognitiveservices     : Manage Azure Cognitive Services accounts.
    config [Experimental] : Manage Azure CLI configuration.
    connection            : Commands to manage Service Connector local connections which allow local
                            environment to connect Azure Resource. If you want to manage connection
                            for compute service, please run 'az webapp/containerapp/spring
                            connection'.
    consumption [Preview] : Manage consumption of Azure resources.
    container             : Manage Azure Container Instances.
    containerapp          : Manage Azure Container Apps.
    cosmosdb              : Manage Azure Cosmos DB database accounts.
    databoxedge [Preview] : Support data box edge device and management.
    deployment            : Manage Azure Resource Manager template deployment at subscription scope.
    deployment-scripts    : Manage deployment scripts at subscription or resource group scope.
    devops                : Manage Azure DevOps organization level operations.
    disk                  : Manage Azure Managed Disks.
    disk-access           : Manage disk access resources.
    disk-encryption-set   : Disk Encryption Set resource.
    dla         [Preview] : Manage Data Lake Analytics accounts, jobs, and catalogs.
    dls         [Preview] : Manage Data Lake Store accounts and filesystems.
    dms                   : Manage Azure Data Migration Service (classic) instances.
    eventgrid             : Manage Azure Event Grid topics, domains, domain topics, system topics
                            partner topics, event subscriptions, system topic event subscriptions
                            and partner topic event subscriptions.
    eventhubs             : Eventhubs.
    extension             : Manage and update CLI extensions.
    feature               : Manage resource provider features.
    functionapp           : Manage function apps. To install the Azure Functions Core tools see
                            https://github.com/Azure/azure-functions-core-tools.
    group                 : Manage resource groups and template deployments.
    hdinsight             : Manage HDInsight resources.
    identity              : Managed Identities.
    image                 : Manage custom virtual machine images.
    iot                   : Manage Internet of Things (IoT) assets.
    keyvault              : Manage KeyVault keys, secrets, and certificates.
    kusto                 : Manage Azure Kusto resources.
    lab         [Preview] : Manage Azure DevTest Labs.
    lock                  : Manage Azure locks.
    logicapp              : Manage logic apps.
    managed-cassandra     : Azure Managed Cassandra.
    managedapp            : Manage template solutions provided and maintained by Independent
                            Software Vendors (ISVs).
    managedservices       : Manage the registration assignments and definitions in Azure.
    maps                  : Manage Azure Maps.
    mariadb               : Manage Azure Database for MariaDB servers.
    monitor               : Manage the Azure Monitor Service.
    mysql                 : Manage Azure Database for MySQL servers.
    netappfiles           : Manage Azure NetApp Files (ANF) Resources.
    network               : Manage Azure Network resources.
    pipelines             : Manage Azure Pipelines.
    policy                : Manage resource policies.
    postgres              : Manage Azure Database for PostgreSQL servers.
    ppg                   : Manage Proximity Placement Groups.
    private-link          : Private-link association CLI command group.
    provider              : Manage resource providers.
    redis                 : Manage dedicated Redis caches for your Azure applications.
    relay                 : Manage Azure Relay Service namespaces, WCF relays, hybrid connections,
                            and rules.
    repos                 : Manage Azure Repos.
    resource              : Manage Azure resources.
    resourcemanagement    : Resourcemanagement CLI command group.
    restore-point         : Manage restore point with res.
    role                  : Manage user roles for access control with Azure Active Directory and
                            service principals.
    search                : Manage Azure Search services, admin keys and query keys.
    security              : Manage your security posture with Microsoft Defender for Cloud.
    servicebus            : Servicebus.
    sf                    : Manage and administer Azure Service Fabric clusters.
    sig                   : Manage shared image gallery.
    signalr               : Manage Azure SignalR Service.
    snapshot              : Manage point-in-time copies of managed disks, native blobs, or other
                            snapshots.
    sql                   : Manage Azure SQL Databases and Data Warehouses.
    sshkey                : Manage ssh public key with vm.
    stack                 : A deployment stack is a native Azure resource type that enables you to
                            perform operations on a resource collection as an atomic unit.
    staticwebapp          : Manage static apps.
    storage               : Manage Azure Cloud Storage resources.
    synapse               : Manage and operate Synapse Workspace, Spark Pool, SQL Pool.
    tag                   : Tag Management on a resource.
    term   [Experimental] : Manage marketplace agreement with marketplaceordering.
    ts                    : Manage template specs at subscription or resource group scope.
    vm                    : Manage Linux or Windows virtual machines.
    vmss                  : Manage groupings of virtual machines in an Azure Virtual Machine Scale
                            Set (VMSS).
    webapp                : Manage web apps.

Commands:
    configure             : Manage Azure CLI configuration. This command is interactive.
    feedback              : Send feedback to the Azure CLI Team.
    find                  : I'm an AI robot, my advice is based on our Azure documentation as well
                            as the usage patterns of Azure CLI and Azure ARM users. Using me
                            improves Azure products and documentation.
    init   [Experimental] : It's an effortless setting up tool for configs.
    interactive [Preview] : Start interactive mode. Installs the Interactive extension if
                            not installed already.
    login                 : Log in to Azure.
    logout                : Log out to remove access to Azure subscriptions.
    rest                  : Invoke a custom request.
    survey                : Take Azure CLI survey.
    upgrade     [Preview] : Upgrade Azure CLI and extensions.
    version               : Show the versions of Azure CLI modules and extensions in JSON format by
                            default or format configured by --output.

To search AI knowledge base for examples, use: az find "az "

cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x03B29808>]
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 2.175 seconds (init: 0.312, invoke: 1.863)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3283 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\JesseHouwing\.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

Command index cache is used.

This behavior only occurs when running top-level --help, calling az vm --help --debug doesn't rebuild the command index.

Environment Summary

az --version
azure-cli                         2.52.0

core                              2.52.0
telemetry                          1.1.0

Extensions:
azure-devops                      0.26.0
containerapp                      0.3.29
init                               0.1.0

Dependencies:
msal                            1.24.0b1
azure-mgmt-resource             23.1.0b2

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\JesseHouwing\.azure\cliextensions'

Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:05:00) [MSC v.1929 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

Command index cache is used.

This behavior only occurs when running top-level --help, calling az vm --help --debug doesn't rebuild the command index.

@jessehouwing jessehouwing added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Sep 21, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Compute az vm/vmss/image/disk/snapshot labels Sep 21, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Web Apps az webapp CXP Attention This issue is handled by CXP team. labels Sep 21, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Sep 21, 2023

Thank you for opening this issue, we will look into it.

@yonzhan yonzhan added this to the Backlog milestone Sep 21, 2023
@yonzhan yonzhan removed the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Sep 21, 2023
@bebound
Copy link
Contributor

bebound commented Sep 21, 2023

This is by design.
We have to load every module to know how many subgroups are available.

@jessehouwing
Copy link
Author

Isn't that information cached in the command index? It feels like a lot of overhead for something that should be up to date in the case 99% of the time.

@bebound
Copy link
Contributor

bebound commented Sep 25, 2023

The command index only contains the mapping between subgroups and modules.

In this command, No module found from index for '['--help', '--debug']' and it loads all module.
It also reasonable that the help message is not cached and has to be load from the modules.

@PramodValavala-MSFT PramodValavala-MSFT added Service Attention This issue is responsible by Azure service team. and removed CXP Attention This issue is handled by CXP team. labels Sep 28, 2023
@microsoft-github-policy-service
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @adamedx.

@microsoft-github-policy-service
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @TravisCragg-MSFT, @nikhilpatel909, @sandeepraichura, @hilaryw29, @GabstaMSFT, @ramankumarlive, @ushnaarshadkhan.

@microsoft-github-policy-service
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/azure-iot-cli-triage.

@microsoft-github-policy-service
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

@TravisCragg-MSFT TravisCragg-MSFT removed the Compute az vm/vmss/image/disk/snapshot label Sep 28, 2023
@seligj95 seligj95 removed the Web Apps az webapp label Oct 3, 2023
@bebound bebound closed this as completed Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AAD Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Installation question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

10 participants