Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
382 stars 1.21k forks source link

az monitor app-insights with --output gives no output #4472

Open cyclops1982 opened 2 years ago

cyclops1982 commented 2 years ago

Describe the bug

az monitor app-insights with --output provides no output, while without --output it works fine.

Example command that works:

$ az monitor app-insights query -g resource -a name --analytics-query "requests | where url contains '.servicebus.windows.net/t_'" --start-time "2022-02-01" --offset 30d | wc -l
28629

Example that doesn't work

$ az monitor app-insights query -g resource -a name --analytics-query "requests | where url contains '.servicebus.windows.net/t_'" --start-time "2022-02-01" --offset 30d --output table | wc -l
1

Command Name az monitor app-insights query Extension Name: application-insights. Version: 0.1.15.

To Reproduce:

Run az monitor app-insights query with --output

Expected Behavior

Get output in the specified output

Environment Summary

Linux-5.10.0-11-amd64-x86_64-with-debian-11.2, Debian GNU/Linux 11 (bullseye)
Python 3.6.10
Installer: DEB

azure-cli 2.33.1

Extensions:
application-insights 0.1.15

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0
yonzhan commented 2 years ago

monitor

YuanyuanNi commented 2 years ago

Hi, 'az monitor app-insights query -- --output json/yaml 'works well , notice that when the query command with --output table has no results , the result will be in the form of blank. Best wishes.

cyclops1982 commented 2 years ago

Thanks @YuanyuanNi I've noticed that --output table results in an empty result if there are no rows. I tested this with a query that /does/ provide a result, so i expect --table to NOT be empty...

ghost commented 2 years ago

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

Issue Details
## Describe the bug `az monitor app-insights` with `--output` provides no output, while without `--output` it works fine. Example command that works: ``` $ az monitor app-insights query -g resource -a name --analytics-query "requests | where url contains '.servicebus.windows.net/t_'" --start-time "2022-02-01" --offset 30d | wc -l 28629 ``` Example that doesn't work ``` $ az monitor app-insights query -g resource -a name --analytics-query "requests | where url contains '.servicebus.windows.net/t_'" --start-time "2022-02-01" --offset 30d --output table | wc -l 1 ``` **Command Name** `az monitor app-insights query Extension Name: application-insights. Version: 0.1.15.` ## To Reproduce: Run `az monitor app-insights query` with `--output` ## Expected Behavior Get output in the specified output ## Environment Summary ``` Linux-5.10.0-11-amd64-x86_64-with-debian-11.2, Debian GNU/Linux 11 (bullseye) Python 3.6.10 Installer: DEB azure-cli 2.33.1 Extensions: application-insights 0.1.15 Dependencies: msal 1.16.0 azure-mgmt-resource 20.0.0 ```
Author: cyclops1982
Assignees: kairu-ms
Labels: `customer-reported`, `Monitor`, `Service Attention`, `Auto Assign`, `Traiged`
Milestone: Backlog
YuanyuanNi commented 2 years ago

Hi, The --output table here are different with the common table we think .As the output is an object , so CLI does not support this command to output in the form of table. Best wishes.

mariomeyrelles commented 1 year ago

I am facing the same issue. Is there any workaround to convert to CSV, at least?