can we ignore a metric which does not belong to the resource while calling listWithResponse

Yogesh Prasad Kurmi 0 Reputation points
2023-01-31T14:18:43.69+00:00

Question
Hi Team,
I am trying to write a client application which gets the metrics for the resources and to save some API calls I am caching the metric definition by a resource type assuming all the resources under that resource type will have the same metrics. Later I found that's not the case some resources are having a different set of metrics even though they are under the same resource type.
Can someone confirm my understanding is correct?

When I am calling below method
listWithResponse(String var1, String var2, Duration var3, String var4, String var5, Integer var6, String var7, String var8, ResultType var9, String var10, Context var11)
to get the metrics with the additional metric which does not belongs to the resource it is throwing below error:

com.azure.core.management.exception.ManagementException: Status code 400, "{"code":"BadRequest","message":"Failed to find metric configuration for provider: Microsoft.Network, resource Type: publicIPAddresses, metric: VipAvailability, Valid metrics: PacketsInDDoS,PacketsDroppedDDoS,PacketsForwardedDDoS,TCPPacketsInDDoS,TCPPacketsDroppedDDoS,TCPPacketsForwardedDDoS,UDPPacketsInDDoS,UDPPacketsDroppedDDoS,UDPPacketsForwardedDDoS,BytesInDDoS,BytesDroppedDDoS,BytesForwardedDDoS,TCPBytesInDDoS,TCPBytesDroppedDDoS,TCPBytesForwardedDDoS,UDPBytesInDDoS,UDPBytesDroppedDDoS,UDPBytesForwardedDDoS,IfUnderDDoSAttack,DDoSTriggerTCPPackets,DDoSTriggerUDPPackets,DDoSTriggerSYNPackets"}"

Why can't we ignore a metric which does not belong to the resource?

Basically, I don't want to make the API calls per resource to know the metric definition as this will cost when we will have a good amount of resources.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,469 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.