The 400 error occurs because the metric ApplicationGatewayTotalTime is not supported for the specific SKU of the resource being queried. Azure metrics are documented by individual Resource Providers, and not all metrics apply to all resource SKUs. To determine which metrics are available for a specific resource, you should use the Metric Definitions API call, which will return only the applicable metrics for the given resource ID.
To resolve this issue, follow these steps:
- Use the Metric Definitions API to query the metrics available for your specific resource. This call will filter out any metrics that do not apply to the resource based on its SKU.
- Adjust your configuration to use only the metrics that are returned by the Metric Definitions API for the specific resource you are working with.
For more detailed information, refer to the following Azure documentation:
- Metric Definitions API
- Metrics supported by Application Gateway v1 SKU
- Supported Metrics for Application Gateways
- Azure Metrics Exporter
Please do not forget to "up-vote" wherever the information provided helps you, as this can be beneficial to other community members.