Open dattasoumya92 opened 1 year ago
Thank you for the feedback @dattasoumya92 . We will investigate asap
Thank you for your feedback. This has been routed to the support team for assistance.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @SameergMS, @dadunl.
Author: | dattasoumya92 |
---|---|
Assignees: | msyyc |
Labels: | `question`, `Monitor`, `Service Attention`, `Mgmt`, `customer-reported` |
Milestone: | - |
@kashifkhan Thanks for you feedback, we are routing this issue to respective team to look into.
Hi @dattasoumya92 You can try to refer to this Sample to solve your problem: https://github.com/Azure-Samples/azure-samples-python-management/blob/main/samples/monitor/manage_metric_list.py
Hi @dattasoumya92 You can try to refer to this Sample to solve your problem: https://github.com/Azure-Samples/azure-samples-python-management/blob/main/samples/monitor/manage_metric_list.py
Hi @Wzb123456789 : The sample that you provided does not resolve my issue. The code you provided lets me filter the metric data result which is not what I'm looking for. Let me re-iterate one more time for better understanding --
In the cli version of "monitor metrics list" , the option --dimension "ResponseType"
acts as a "Group By" function i.e. it groups the metric result in groups of distinct "ResponseType" values.
And the issue I stated above is that this particular function is NOT available in the python sdk version of "monitor metrics list", i.e. MonitorManagementClient: metrics.list()
Hoping to get a response soon.
Since the SDK is generated by swagger
, it is responsible for receiving the data returned by the service and displaying it to the user after processing, so the SDK will not modify or delete a certain parameter.
There is no operation similar to group by
in the swagger definition, so there is no similar operation in the generated Python SDK.
swagger definition: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metrics_API.json#L41
As a workaround I use a filter in client.query_resource() function. You need to get familiar with the dimension names first and use filter like:
filter="Power Supply eq '*'"
or
filter="Component eq '*' and Controller eq '*' and Index eq '*'"
for multidimensional metrics.
You may need to set max_results to a higher value (default is 10).
An option like Dimension or Split By should be provided which is currently not available in azure-monitor-mgmt client "metrics.list" method .
Package class: azure.mgmt.monitor._monitor_management_client.MonitorManagementClient Operation Method: metrics.list()
A "--dimension" option which is provided in az cli command , similar parameter can be provided in its python sdk counterpart -
Az CLI Reference from: https://learn.microsoft.com/en-us/cli/azure/monitor/metrics?view=azure-cli-latest#az-monitor-metrics-list
Az monitor metrics Python SDK Reference from: https://learn.microsoft.com/en-us/python/api/azure-mgmt-monitor/azure.mgmt.monitor.v2018_01_01.operations.metricsoperations?view=azure-python#azure-mgmt-monitor-v2018-01-01-operations-metricsoperations-list