|
| 1 | +--- |
| 2 | +title: Autoscale in Azure using a custom metric |
| 3 | +description: Learn how to scale your web app by using custom metrics in the Azure portal. |
| 4 | +author: EdB-MSFT |
| 5 | +ms.author: edbaynash |
| 6 | +ms.service: azure-monitor |
| 7 | +ms.subservice: autoscale |
| 8 | +ms.topic: how-to |
| 9 | +ms.date: 06/22/2022 |
| 10 | +ms.reviewer: akkumari |
| 11 | + |
| 12 | +# Customer intent: As a dev opps admin I want to collect and analyze autoscale metrics and logs |
| 13 | +--- |
| 14 | + |
| 15 | +>>> Where is the flapping logs ? |
| 16 | +
|
| 17 | + |
| 18 | +# Diagnostic settings in Autoscale |
| 19 | + |
| 20 | +Autoscale has two log categories and a set of metrics which can be enabled via the **Diagnostics settings** tab on the autoscale settings page. |
| 21 | + |
| 22 | +The two categories are |
| 23 | +* [Autoscale Evaluations](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/autoscaleevaluationslog) containing log data relating to rule evaluation. |
| 24 | +* [Autoscale Scale Actions](https://learn.microsoft.com/azure/azure-monitor/reference/tables/autoscalescaleactionslog) log data relating to each scale event. |
| 25 | + |
| 26 | + |
| 27 | +Information about Autoscale Metrics cn be found in the [Supported metrics](../essentials/metrics-supported#microsoftinsightsautoscalesettings) reference. |
| 28 | + |
| 29 | +Both the logs and metrics can be sent to a variety of destinations including: |
| 30 | +* Log Analytics workspaces |
| 31 | +* Storage accounts |
| 32 | +* Event hubs |
| 33 | +* Partner solutions |
| 34 | + |
| 35 | +For mor information on diagnostics see [Diagnostic settings in Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings?tabs=portal) |
| 36 | + |
| 37 | +## Resource log schemas |
| 38 | + |
| 39 | +Following are the general formats for autoscale resource logs with example data included. Not all examples below are properly formed JSON because they may include multiple values that could be valid for a given field. |
| 40 | + |
| 41 | +Use events of this type to troubleshoot problems you may be having with autoscale. For more information, see [Troubleshooting autoscale problems](autoscale-troubleshoot.md). |
| 42 | + |
| 43 | +## Autoscale Evaluations Log |
| 44 | +The following schemas appear in the autoscale evaluations log. |
| 45 | + |
| 46 | +### Profile evaluation |
| 47 | + |
| 48 | +Recorded when autoscale first looks at an autoscale profile |
| 49 | + |
| 50 | +```json |
| 51 | +{ |
| 52 | + "time": "2018-09-10 18:12:00.6132593", |
| 53 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 54 | + "operationName": ["FixedDateProfileEvaluation", "RecurrentProfileEvaluation", "DefaultProfileEvaluation"], |
| 55 | + "category": "AutoscaleEvaluations", |
| 56 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 57 | + "property": { |
| 58 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 59 | + "profile": "defaultProfile", |
| 60 | + "profileSelected": [true, false] |
| 61 | + } |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +### Profile cooldown evaluation |
| 66 | + |
| 67 | +Recorded when autoscale evaluates if it should not do a scale because of a cool down period. |
| 68 | + |
| 69 | +```json |
| 70 | +{ |
| 71 | + "time": "2018-09-10 18:12:00.6132593", |
| 72 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 73 | + "operationName": "ScaleRuleCooldownEvaluation", |
| 74 | + "category": "AutoscaleEvaluations", |
| 75 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 76 | + "property": { |
| 77 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 78 | + "selectedProfile": "defaultProfile", |
| 79 | + "scaleDirection": ["Increase", "Decrease"] |
| 80 | + "lastScaleActionTime": "2018-09-10 18:08:00.6132593", |
| 81 | + "cooldown": "00:30:00", |
| 82 | + "evaluationTime": "2018-09-10 18:11:00.6132593", |
| 83 | + "skipRuleEvaluationForCooldown": true |
| 84 | + } |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +### Rule evaluation |
| 89 | + |
| 90 | +Recorded when autoscale first starts evaluating a particular scale rule. |
| 91 | + |
| 92 | +```json |
| 93 | +{ |
| 94 | + "time": "2018-09-10 18:12:00.6132593", |
| 95 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 96 | + "operationName": "ScaleRuleEvaluation", |
| 97 | + "category": "AutoscaleEvaluations", |
| 98 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 99 | + "property": { |
| 100 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 101 | + "metricName": "Percentage CPU", |
| 102 | + "metricNamespace": "", |
| 103 | + "timeGrain": "00:01:00", |
| 104 | + "timeGrainStatistic": "Average", |
| 105 | + "timeWindow": "00:10:00", |
| 106 | + "timeAggregationType": "Average", |
| 107 | + "operator": "GreaterThan", |
| 108 | + "threshold": 70, |
| 109 | + "observedValue": 25, |
| 110 | + "estimateScaleResult": ["Triggered", "NotTriggered", "Unknown"] |
| 111 | + } |
| 112 | +} |
| 113 | +``` |
| 114 | + |
| 115 | +### Metric evaluation |
| 116 | + |
| 117 | +Recorded when autoscale evaluated the metric being used to trigger a scale action. |
| 118 | + |
| 119 | +```json |
| 120 | +{ |
| 121 | + "time": "2018-09-10 18:12:00.6132593", |
| 122 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 123 | + "operationName": "MetricEvaluation", |
| 124 | + "category": "AutoscaleEvaluations", |
| 125 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 126 | + "property": { |
| 127 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 128 | + "metricName": "Percentage CPU", |
| 129 | + "metricNamespace": "", |
| 130 | + "timeGrain": "00:01:00", |
| 131 | + "timeGrainStatistic": "Average", |
| 132 | + "startTime": "2018-09-10 18:00:00.43833793", |
| 133 | + "endTime": "2018-09-10 18:10:00.43833793", |
| 134 | + "data": [0.33333333333333331,0.16666666666666666,1.0,0.33333333333333331,2.0,0.16666666666666666,9.5] |
| 135 | + } |
| 136 | +} |
| 137 | +``` |
| 138 | + |
| 139 | +### Instance count evaluation |
| 140 | + |
| 141 | +Recorded when autoscale evaluates the number of instances already running in preparation for deciding if it should start more, shut down some, or do nothing. |
| 142 | + |
| 143 | +```json |
| 144 | +{ |
| 145 | + "time": "2018-09-10 18:12:00.6132593", |
| 146 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 147 | + "operationName": "InstanceCountEvaluation", |
| 148 | + "category": "AutoscaleEvaluations", |
| 149 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 150 | + "property": { |
| 151 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 152 | + "currentInstanceCount": 20, |
| 153 | + "minimumInstanceCount": 15, |
| 154 | + "maximumInstanceCount": 30, |
| 155 | + "defaultInstanceCount": 20 |
| 156 | + } |
| 157 | +} |
| 158 | +``` |
| 159 | + |
| 160 | +### Scale action evaluation |
| 161 | + |
| 162 | +Recorded when autoscale starts evaluation if a scale action should take place. |
| 163 | + |
| 164 | +```json |
| 165 | +{ |
| 166 | + "time": "2018-09-10 18:12:00.6132593", |
| 167 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 168 | + "operationName": "ScaleActionOperationEvaluation", |
| 169 | + "category": "AutoscaleEvaluations", |
| 170 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 171 | + "property": { |
| 172 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 173 | + "lastScaleActionOperationId": "378ejr-7yye-892d-17dd-92ndijfe1738", |
| 174 | + "lastScaleActionOperationStatus": ["InProgress", "Timeout"] |
| 175 | + "skipCurrentAutoscaleEvaluation": [true, false] |
| 176 | + } |
| 177 | +} |
| 178 | +``` |
| 179 | + |
| 180 | +### Instance update evaluation |
| 181 | + |
| 182 | +Recorded when autoscale updates the number of compute instances running, either up or down. |
| 183 | + |
| 184 | +```json |
| 185 | +{ |
| 186 | + "time": "2018-09-10 18:12:00.6132593", |
| 187 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 188 | + "operationName": "InstanceUpdateEvaluation", |
| 189 | + "category": "AutoscaleEvaluations", |
| 190 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 191 | + "property": { |
| 192 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 193 | + "currentInstanceCount": 20, |
| 194 | + "newInstanceCount": 21, |
| 195 | + "shouldUpdateInstance": [true, false], |
| 196 | + "reason": ["Scale down action triggered", "Scale up to default instance count", ...] |
| 197 | + } |
| 198 | +} |
| 199 | +``` |
| 200 | + |
| 201 | +## Autoscale Scale Actions Log |
| 202 | + |
| 203 | +The following schemas appear in the autoscale evaluations log. |
| 204 | + |
| 205 | + |
| 206 | +### Scale action |
| 207 | + |
| 208 | +Recorded when autoscale initiates a scale action, either up or down. |
| 209 | +```json |
| 210 | +{ |
| 211 | + "time": "2018-09-10 18:12:00.6132593", |
| 212 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 213 | + "operationName": "InstanceScaleAction", |
| 214 | + "category": "AutoscaleScaleActions", |
| 215 | + "resultType": ["Succeeded", "InProgress", "Failed"], |
| 216 | + "resultDescription": ["Create async operation job failed", ...] |
| 217 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 218 | + "property": { |
| 219 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 220 | + "currentInstanceCount": 20, |
| 221 | + "newInstanceCount": 21, |
| 222 | + "scaleDirection": ["Increase", "Decrease"], |
| 223 | + ["createdAsyncScaleActionJob": [true, false],] |
| 224 | + ["createdAsyncScaleActionJobId": "378ejr-7yye-892d-17dd-92ndijfe1738",] |
| 225 | + } |
| 226 | +} |
| 227 | +``` |
| 228 | + |
| 229 | +### Scale action tracking |
| 230 | + |
| 231 | +Recorded at different intervals of an instance scale action. |
| 232 | + |
| 233 | +```json |
| 234 | +{ |
| 235 | + "time": "2018-09-10 18:12:00.6132593", |
| 236 | + "resourceId": "/SUBSCRIPTIONS/BA13C41D-C957-4774-8A37-092D62ACFC85/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING", |
| 237 | + "operationName": "InstanceScaleAction", |
| 238 | + "category": "AutoscaleScaleActions", |
| 239 | + "correlationId": "e8f67045-f381-445d-bc2d-eeff81ec0d77", |
| 240 | + "property": { |
| 241 | + "targetResourceId": "/subscriptions/d45c994a-809b-4cb3-a952-e75f8c488d23/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy", |
| 242 | + "scaleActionOperationId": "378ejr-7yye-892d-17dd-92ndijfe1738", |
| 243 | + "scaleActionOperationStatus": ["InProgress", "Timeout", "Canceled", ...], |
| 244 | + "scaleActionMessage": ["Scale action is inprogress", ...] |
| 245 | + } |
| 246 | +} |
| 247 | +``` |
| 248 | + |
| 249 | + |
0 commit comments