azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

az monitor app-insights query does not return anything compared to query in portal

Open vmachacek opened this issue 6 months ago • 5 comments

Describe the bug

When I do where clause in the query it does return 1 row while running same query in the web ui returns ~20

Related command

traces | where customDimensions.OriginalFormat == 'Startup' and timestamp > ago(30d)

Errors

no error message recieved

Issue script & Debug output

cli.knack.cli: Command arguments: ['monitor', 'app-insights', 'query', '--app', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx', '--analytics-query', "traces | where customDimensions.OriginalFormat == 'Startup' and timestamp > ago(30d)", '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
Init colorama.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x01DA4148>, <function OutputProducer.on_global_arguments at 0x01E11FA0>, <function CLIQuery.on_global_arguments at 0x01F37BB0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'monitor': ['azure.cli.command_modules.monitor', 'azext_applicationinsights']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: monitor                   0.007        32       133
cli.azure.cli.core: Total (1)                 0.007        32       133
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: application-insights      0.004        10        30  C:\Users\vmach\.azure\cliextensions\application-insights
cli.azure.cli.core: Total (1)                 0.004        10        30
cli.azure.cli.core: Loaded 41 groups, 163 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : monitor app-insights query
cli.azure.cli.core: Command table: monitor app-insights query
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x03A830B8>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\vmach\.azure\commands\2023-12-19.18-24-36.monitor_app-insights_query.34268.log'.
az_command_data_logger: command args: monitor app-insights query --app {} --analytics-query {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x03AC8148>, <function register_global_query_examples_argument.<locals>.register_query_examples at 0x03ADA850>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x03ADA898>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x03ADA928>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x01E21028>, <function CLIQuery.handle_query_parameter at 0x01F37BF8>, <function register_global_query_examples_argument.<locals>.handle_example_parameter at 0x03ADA808>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x03ADA8E0>]
az_command_data_logger: extension name: application-insights
az_command_data_logger: extension version: 0.1.17
msrest.universal_http.requests: Configuring retry: max_retries=3, backoff_factor=0.8, max_backoff=90
cli.azure.cli.core.adal_authentication: AdalAuthentication.signed_session invoked by Track 1 SDK
cli.azure.cli.core._profile: Retrieving token from ADAL for resource 'https://api.applicationinsights.io'
cli.azure.cli.core.util: attempting to read file C:\Users\vmach\.azure\accessTokens.json as utf-8-sig
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - Authority:Performing instance discovery: ...
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - Authority:Performing static instance discovery
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - Authority:Authority validated via static instance discovery
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - TokenRequest:Getting token from cache with refresh if necessary.
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - CacheDriver:finding with query keys: {'_clientId': '...', 'userId': '...'}
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - CacheDriver:Looking for potential cache entries: {'_clientId': '...', 'userId': '...'}
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - CacheDriver:Found 4 potential entries.
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - CacheDriver:Resource specific token found.
adal-python: 121f50c7-1595-4d4f-92e8-1a093f010254 - CacheDriver:Returning token from cache lookup, AccessTokenId: b'uc7AGtsoNrl6RuaXt3Hqmj/Y9SO96toK1kAEoISy0bQ=', RefreshTokenId: b'f/KDQesRC01DsAI3NcpZ8GBfhfUokB+Bv7S9EJb60Kw='
msrest.universal_http: Configuring redirects: allow=True, max=30
msrest.universal_http: Configuring request: timeout=100, verify=True, cert=None
msrest.universal_http: Configuring proxies: ''
msrest.universal_http: Evaluate proxies against ENV settings: True
urllib3.connectionpool: Starting new HTTPS connection (1): api.applicationinsights.io:443

Expected behavior

the returned number of rows should match the one returned from web ui

Environment Summary

azure-cli                         2.29.0 *

core                              2.29.0 *
telemetry                          1.0.6 *

Extensions:
application-insights              0.1.17
azure-devops                      0.21.0

Additional context

No response

vmachacek avatar Dec 19 '23 23:12 vmachacek