Mrki
Mrki

Reputation: 13

AppInsights custom metric for autoscaling of azure web apps not supported

I was following this tutorial on autoscaling web apps on on custom metric (https://learn.microsoft.com/en-us/azure/azure-monitor/platform/autoscale-custom-metric) and unfortunately Azure keeps telling me that my custom metric is not supported for the deployed web app. Can anybody please help me and point out why my web app cannot be scaled by custom metric. If needed, I am located in Austria and was deploying the web app to West Europe.

Thanks in advance!

Metric 'NumOfRequests' is not supported for resource '/subscriptions/4c6ad49f-5448-4a16-bef1-de2342c0626e/resourceGroups/dtc/providers/microsoft.insights/components/AppInsightsTestApp201

{  
   "authorization":{  
      "action":"microsoft.insights/autoscalesettings/write",
      "scope":"/subscriptions/4c6ad49f-5448-4a16-bef1-de2342c0626e/resourceGroups/dtc/providers/microsoft.insights/autoscalesettings/dtc-serviceplan-low-prod-webwts-Autoscale-468"
   },
   "caller":"[email protected]",
   "channels":"Operation",  
   "correlationId":"79d4a60d-f03b-4e3e-b556-8326f202086c",
   "description":"",
   "eventDataId":"c157fde0-301d-475c-bda6-cdb5a52420ed",
   "eventName":{  
      "value":"EndRequest",
      "localizedValue":"End request"
   },
   "category":{  
      "value":"Administrative",
      "localizedValue":"Administrative"
   },
   "eventTimestamp":"2019-06-05T07:12:12.5615148Z",
   "id":"/subscriptions/4c6ad49f-5448-4a16-bef1-de2342c0626e/resourceGroups/dtc/providers/microsoft.insights/autoscalesettings/dtc-serviceplan-low-prod-webwts-Autoscale-468/events/c157fde0-301d-475c-bda6-cdb5a52420ed/ticks/636953155325615148",
   "level":"Error",
   "operationId":"79d4a60d-f03b-4e3e-b556-8326f202086c",
   "operationName":{  
      "value":"microsoft.insights/autoscalesettings/write",
      "localizedValue":"Update autoscale setting"
   },
   "resourceGroupName":"dtc",
   "resourceProviderName":{  
      "value":"microsoft.insights",
      "localizedValue":"Microsoft Insights"
   },
   "resourceType":{  
      "value":"microsoft.insights/autoscalesettings",
      "localizedValue":"microsoft.insights/autoscalesettings"
   },
   "resourceId":"/subscriptions/4c6ad49f-5448-4a16-bef1-de2342c0626e/resourceGroups/dtc/providers/microsoft.insights/autoscalesettings/dtc-serviceplan-low-prod-webwts-Autoscale-468",
   "status":{  
      "value":"Failed",
      "localizedValue":"Failed"
   },
   "subStatus":{  
      "value":"BadRequest",
      "localizedValue":"Bad Request (HTTP Status Code: 400)"
   },
   "submissionTimestamp":"2019-06-05T07:13:48.1357184Z",
   "subscriptionId":"4c6ad49f-5448-4a16-bef1-de2342c0626e",
   "properties":{  
      "statusCode":"BadRequest",
      "serviceRequestId":"00000000-0000-0000-0000-000000000000",
      "statusMessage":"{\"code\":\"UnsupportedMetric\",\"message\":\"Metric 'NumOfRequests' is not supported for resource '/subscriptions/4c6ad49f-5448-4a16-bef1-de2342c0626e/resourceGroups/dtc/providers/microsoft.insights/components/AppInsightsTestApp20190604021321'\"}"
   },
   "relatedEvents":[  

   ]
}

Edit I am sending my custom metrics from application like this to Application Insights: Code for sending custom metrics. In Azure Web App I try to configure the autoscaling like: Configuring autoscaling by custom metric. As it can be seen on the image, I am targeting metric namespace "azure.applicationinsights", which really contains my custom metric, but upon saving Azure tells me that it is not possible: enter image description here

Upvotes: 0

Views: 658

Answers (1)

AmanGarg-MSFT
AmanGarg-MSFT

Reputation: 1153

I followed the document and was able to enable auto scale based on my custom metric:

enter image description here

Please make sure you choose the correct options while adding a rule:

enter image description here

Hope this helps!

Upvotes: 1

Related Questions