azure-sdk-for-js icon indicating copy to clipboard operation
azure-sdk-for-js copied to clipboard

Calling Metrics list at subscription scope gives an ApiVersion: 2018-01-01 error

Open srini1978 opened this issue 1 year ago • 5 comments

  • Package Name: azure/arm-monitor
  • Package Version: 7.0.0
  • Operating system: Windows
  • [ ] nodejs
    • version: 21.7.1
  • [ ] browser
    • name/version:
  • [ ] typescript
    • version: 5.4.3
  • Is the bug related to documentation in
    • [ ] README.md
    • [ ] source code documentation
    • [ ] SDK API docs on https://docs.microsoft.com

Describe the bug We have a typescript code that makes a call to get metrics from multiple resources using Azure monitor REST API call. The API we are using is https://management.azure.com/subscriptions/12345678-abcd-98765432-abcdef012345/providers/microsoft.Insights/metrics?timespan=2023-06-25T22:20:00.000Z/2023-06-26T22:25:00.000Z&interval=PT5M&metricnames=Percentage CPU&aggregation=average&api-version=2021-05-01&region=eastus&metricNamespace=microsoft.compute/virtualmachines&$filter=Microsoft.ResourceId eq '*'

However when we make a call to this API from our code, we get an error " ApiVersion: 2018-01-01 does not support query at non Arm resource Id level"

To Reproduce Steps to reproduce the behavior:

  1. Attached the code that we use to run.
  2. I think the error is happening on the line which is calling the monitorclient API azure-api.txt

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Screenshot 2024-03-21 202049

Additional context Add any other context about the problem here.

srini1978 avatar Mar 21 '24 15:03 srini1978

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

github-actions[bot] avatar Mar 21 '24 15:03 github-actions[bot]

@srini1978 Currently we only allow to set apiVersion for client operations share the same version, but for monitor its operations would have multiple apiVersions and this is not supported. We will review this on how to support it internally.

As a workaround you could follow the guide to add a policy to customize your apiVersion.

MaryGao avatar Mar 22 '24 04:03 MaryGao

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

github-actions[bot] avatar Mar 22 '24 05:03 github-actions[bot]

@jamlai The apiVersion for metrics operations in JS SDK(code here) is still 2018-01-01 but the latest version is already 2023-01-01(spec here), this would cause customers failed to call list operation.

Could we have a release request to upgrade them?

image https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/rest-api-walkthrough?tabs=portal#retrieve-metric-values

MaryGao avatar Mar 22 '24 05:03 MaryGao

@MaryGao Any update on this ?

srini1978 avatar Mar 26 '24 08:03 srini1978

@srini1978 I am preparing the release and feel free to take a look! https://github.com/Azure/azure-sdk-for-js/pull/29089

MaryGao avatar Mar 28 '24 07:03 MaryGao

create a release request https://github.com/Azure/sdk-release-request/issues/5097 to track sdk progress

kazrael2119 avatar Mar 29 '24 09:03 kazrael2119

released: https://www.npmjs.com/package/@azure/arm-monitor/v/8.0.0-beta.5.

MaryGao avatar Mar 29 '24 10:03 MaryGao