Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.67k stars 5.1k forks source link

Metrics query working on SDK 5.01 now fails wit 6.0 #23669

Open ajpogue opened 1 year ago

ajpogue commented 1 year ago

Describe the bug python queries worked as expected - Using notebook with Databricks, azsdk-python-azure-mgmt-monitor/5.0.1 Python/3.8.10 (Linux-5.4.0-1100-azure-x86_64-with-glibc2.29)

query fails with http 400 bad request error - Using notebook with Databricks, "userAgent": azsdk-python-azure-mgmt-monitor/6.0.0 Python/3.8.10 (Linux-5.4.0-1100-azure-x86_64-with-glibc2.29)

To Reproduce see URLS below

Expected behavior metric data returned.

Additional context Bad one: "PreciseTimeStamp": 2023-03-21T04:00:57.0483802Z, "TaskName": HttpIncomingRequestEndWithClientFailure, "operationName": GET/SUBSCRIPTIONS/RESOURCEGROUPS/PROVIDERS/MICROSOFT.ANALYSISSERVICES/SERVERS/PROVIDERS/MICROSOFT.INSIGHTS/METRICS, "apiVersion": 2021-05-01, "httpMethod": GET, "httpStatusCode": 400, "targetUri": [https://management.azure.com:443/subscriptions/subid/resourceGroups/RG/providers/Microsoft.AnalysisServices/servers/servername/providers/providers/Microsoft.Insights/metrics?timespan=2023-03-20%2f2023-03-21&interval=PT1M&metricnames=qpu_metric%2cmemory_metric%2cMemoryLimitHard%2cQueryPoolJobQueueLength&aggregation=Average&api-version=2021-05-01] "targetResourceProvider": MICROSOFT.INSIGHTS, "targetResourceType": METRICS, "userAgent": azsdk-python-azure-mgmt-monitor/6.0.0 Python/3.8.10 (Linux-5.4.0-1100-azure-x86_64-with-glibc2.29)

  Good one:  "PreciseTimeStamp": 2023-03-20T04:00:46.8433581Z, "TaskName": HttpIncomingRequestEndWithSuccess, "operationName": GET/SUBSCRIPTIONS/RESOURCEGROUPS/PROVIDERS/MICROSOFT.ANALYSISSERVICES/SERVERS/PROVIDERS/MICROSOFT.INSIGHTS/METRICS, "apiVersion": 2018-01-01, "httpMethod": GET, "httpStatusCode": 200, "targetUri": https://management.azure.com:443/subscriptions/subid/resourceGroups/RG/providers/Microsoft.AnalysisServices/servers/servername/providers/Microsoft.Insights/metrics?timespan=2023-03-19%2f2023-03-20&interval=PT1M&metricnames=qpu_metric%2cmemory_metric%2cMemoryLimitHard%2cQueryPoolJobQueueLength&aggregation=Average&api-version=2018-01-01, "targetResourceProvider": MICROSOFT.INSIGHTS, "targetResourceType": METRICS, "userAgent": azsdk-python-azure-mgmt-monitor/5.0.1 Python/3.8.10 (Linux-5.4.0-1100-azure-x86_64-with-glibc2.29)

ghost commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.

tjprescott commented 1 year ago

@msyyc can you please take a look at this?

msyyc commented 1 year ago

Hi @ajpogue Could you paste your Python code which can reproduce the error? And if convenient, please follow https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/debug_guide.md to give us more detailed log.

github-actions[bot] commented 1 year ago

Hi @ajpogue, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

ajpogue commented 1 year ago

This was resolved by adding the previous version of the API ("apiVersion": 2018-01-01,) to the query vs letting it grab the latest version. 1 - specify the api version in this portion of code you are currently using to force using the 2018-01-01 api version. ( please modify based on your code)

resource_metrics = [] for resource in resources: for metric in get_metrics(resource_uri=resource.id, date_start=date_start, date_end=date_end, resource_name=resource.name, interval='PT1M'): resource_metrics.append(metric)

something like this:

resource_metrics = [] for resource in resources: for metric in get_metrics(resource_uri=resource.id, date_start=date_start, date_end=date_end, resource_name=resource.name, interval='PT1M', api_version="2018-01-01"): resource_metrics.append(metric)

2- install the python packages with specifying the previous version using azure-mgmt-monitor==5.0.1 before the api issue is fixed

msyyc commented 1 year ago

According to the info, the REST API with 2021-05-01 doesn't work but it works in 2018-01-01. It is not the SDK error but service problem so I will transfer it to swagger repo.

ghost commented 1 year ago

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

Issue Details
- **Package Name**: python-azure-mgmt-monitor - **Package Version**: 6.0 - **Operating System**: - **Python Version**: 3.8.10 **Describe the bug** python queries worked as expected - Using notebook with Databricks, azsdk-python-azure-mgmt-monitor/5.0.1 Python/3.8.10 (Linux-5.4.0-1100-azure-x86_64-with-glibc2.29) query fails with http 400 bad request error - Using notebook with Databricks, "userAgent": azsdk-python-azure-mgmt-monitor/6.0.0 Python/3.8.10 (Linux-5.4.0-1100-azure-x86_64-with-glibc2.29) **To Reproduce** see URLS below **Expected behavior** metric data returned. **Additional context** Bad one: "PreciseTimeStamp": 2023-03-21T04:00:57.0483802Z, "TaskName": HttpIncomingRequestEndWithClientFailure, "operationName": GET/SUBSCRIPTIONS/RESOURCEGROUPS/PROVIDERS/MICROSOFT.ANALYSISSERVICES/SERVERS/PROVIDERS/MICROSOFT.INSIGHTS/METRICS, "apiVersion": 2021-05-01, "httpMethod": GET, "httpStatusCode": 400, "targetUri": [https://management.azure.com:443/subscriptions/subid/resourceGroups/RG/providers/Microsoft.AnalysisServices/servers/servername/providers/providers/Microsoft.Insights/metrics?timespan=2023-03-20%2f2023-03-21&interval=PT1M&metricnames=qpu_metric%2cmemory_metric%2cMemoryLimitHard%2cQueryPoolJobQueueLength&aggregation=Average&api-version=2021-05-01] "targetResourceProvider": MICROSOFT.INSIGHTS, "targetResourceType": METRICS, "userAgent": azsdk-python-azure-mgmt-monitor/6.0.0 Python/3.8.10 (Linux-5.4.0-1100-azure-x86_64-with-glibc2.29)   Good one:  "PreciseTimeStamp": 2023-03-20T04:00:46.8433581Z, "TaskName": HttpIncomingRequestEndWithSuccess, "operationName": GET/SUBSCRIPTIONS/RESOURCEGROUPS/PROVIDERS/MICROSOFT.ANALYSISSERVICES/SERVERS/PROVIDERS/MICROSOFT.INSIGHTS/METRICS, "apiVersion": 2018-01-01, "httpMethod": GET, "httpStatusCode": 200, "targetUri": https://management.azure.com:443/subscriptions/subid/resourceGroups/RG/providers/Microsoft.AnalysisServices/servers/servername/providers/Microsoft.Insights/metrics?timespan=2023-03-19%2f2023-03-20&interval=PT1M&metricnames=qpu_metric%2cmemory_metric%2cMemoryLimitHard%2cQueryPoolJobQueueLength&aggregation=Average&api-version=2018-01-01, "targetResourceProvider": MICROSOFT.INSIGHTS, "targetResourceType": METRICS, "userAgent": azsdk-python-azure-mgmt-monitor/5.0.1 Python/3.8.10 (Linux-5.4.0-1100-azure-x86_64-with-glibc2.29)
Author: ajpogue
Assignees: SaurabhSharma-MSFT
Labels: `question`, `Monitor`, `Service Attention`, `customer-reported`, `Mgmt`, `needs-team-attention`, `CXP Attention`
Milestone: -
navba-MSFT commented 1 year ago

@ajpogue removing cxp attention since service team is already involved.