自動縮放中的診斷設定
自動縮放有兩個記錄類別和一組計量,可透過 [自動縮放設定] 頁面上的 [診斷設定] 索引標籤來啟用。
這兩個類別如下:
如需自動縮放自動縮放計量的詳細資訊,請參閱支援的計量文件。
您可以將記錄和計量傳送至各種目的地:
- Log Analytics 工作區
- 儲存體帳戶
- 事件中樞
- 合作夥伴解決方案
如需診斷的詳細資訊,請參閱 Azure 監視器中的診斷設定。
執行歷程記錄
在 [執行歷程記錄] 索引標籤上檢視您的自動縮放活動的歷程記錄。[執行歷程記錄] 索引標籤包含一段時間內的資源實例計數圖表,以及進行自動縮放的資源活動記錄項目。
資源記錄結構描述
下列範例是自動縮放資源記錄的一般格式,其中包含範例資料。 並非所有範例的格式都是正確的 JSON 格式,因為它們可能包含指定欄位的有效清單。
請使用這些記錄來排解自動縮放中的問題。 如需詳細資訊,請參閱為自動調整問題疑難排解。
注意
儘管記錄可能會提到「往上增加」(scale up) 和「往下減少」(scale down) 動作,但但實際採取的行動是「向內縮小」(scale in) 或「向外擴充」(scale out)。
自動縮放評估記錄
下列結構描述會出現在自動縮放評估記錄中。
設定檔評估
自動縮放第一次查看自動縮放設定檔時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": ["FixedDateProfileEvaluation", "RecurrentProfileEvaluation", "DefaultProfileEvaluation"],
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"profile": "defaultProfile",
"profileSelected": [true, false]
}
}
設定檔冷卻評估
當自動縮放評估是否不應該因為冷卻期間而進行調整時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "ScaleRuleCooldownEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"selectedProfile": "defaultProfile",
"scaleDirection": ["Increase", "Decrease"]
"lastScaleActionTime": "2018-09-10 18:08:00.6132593",
"cooldown": "00:30:00",
"evaluationTime": "2018-09-10 18:11:00.6132593",
"skipRuleEvaluationForCooldown": true
}
}
規則評估
當自動縮放第一次開始評估特定的調整規則時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "ScaleRuleEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"metricName": "Percentage CPU",
"metricNamespace": "",
"timeGrain": "00:01:00",
"timeGrainStatistic": "Average",
"timeWindow": "00:10:00",
"timeAggregationType": "Average",
"operator": "GreaterThan",
"threshold": 70,
"observedValue": 25,
"estimateScaleResult": ["Triggered", "NotTriggered", "Unknown"]
}
}
計量評估
自動縮放評估用來觸發調整動作的計量時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "MetricEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"metricName": "Percentage CPU",
"metricNamespace": "",
"timeGrain": "00:01:00",
"timeGrainStatistic": "Average",
"startTime": "2018-09-10 18:00:00.43833793",
"endTime": "2018-09-10 18:10:00.43833793",
"data": [0.33333333333333331,0.16666666666666666,1.0,0.33333333333333331,2.0,0.16666666666666666,9.5]
}
}
執行個體計數評估
當自動縮放評估已經執行的執行個體數目,以供決定是否應該啟動更多、關閉部分或不執行任何動作時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "InstanceCountEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"currentInstanceCount": 20,
"minimumInstanceCount": 15,
"maximumInstanceCount": 30,
"defaultInstanceCount": 20
}
}
調整動作評估
當自動縮放開始評估是否應該進行調整動作時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "ScaleActionOperationEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"lastScaleActionOperationId": "2222cccc-33dd-eeee-ff44-aaaaaa555555",
"lastScaleActionOperationStatus": ["InProgress", "Timeout"]
"skipCurrentAutoscaleEvaluation": [true, false]
}
}
執行個體更新評估
當自動縮放更新執行中的計算執行個體數目 (無論增加或減少) 時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "InstanceUpdateEvaluation",
"category": "AutoscaleEvaluations",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"currentInstanceCount": 20,
"newInstanceCount": 21,
"shouldUpdateInstance": [true, false],
"reason": ["Scale down action triggered", "Scale up to default instance count", ...]
}
}
自動縮放調整動作記錄
下列結構描述會出現在自動縮放評估記錄中。
調整動作
當自動縮放起始調整動作 (無論增加或減少) 時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "InstanceScaleAction",
"category": "AutoscaleScaleActions",
"resultType": ["Succeeded", "InProgress", "Failed"],
"resultDescription": ["Create async operation job failed", ...]
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"currentInstanceCount": 20,
"newInstanceCount": 21,
"scaleDirection": ["Increase", "Decrease"],
["createdAsyncScaleActionJob": [true, false],]
["createdAsyncScaleActionJobId": "378ejr-7yye-892d-17dd-92ndijfe1738",]
}
}
縮放動作追蹤
在執行個體調整動作的不同間隔時記錄:
{
"time": "2018-09-10 18:12:00.6132593",
"resourceId": "/SUBSCRIPTIONS/AAAA0A0A-BB1B-CC2C-DD3D-EEEEEE4E4E4E/RESOURCEGROUPS/AUTOSCALETRACKING12042017/PROVIDERS/MICROSOFT.INSIGHTS/AUTOSCALESETTINGS/DEFAULTSETTING",
"operationName": "InstanceScaleAction",
"category": "AutoscaleScaleActions",
"correlationId": "ffff5555-aa66-7777-88bb-999999cccccc",
"property": {
"targetResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/RingAhoy/providers/Microsoft.Web/serverfarms/ringahoy",
"scaleActionOperationId": "378ejr-7yye-892d-17dd-92ndijfe1738",
"scaleActionOperationStatus": ["InProgress", "Timeout", "Canceled", ...],
"scaleActionMessage": ["Scale action is inprogress", ...]
}
}
活動記錄
下列事件會記錄到活動記錄檔中,其 CategoryValue
為 Autoscale
:
- 自動縮放往上增加已起始
- 自動縮放往上增加已完成
- 自動縮放往下減少已起始
- 自動縮放往下減少已完成
- 預測性自動縮放往上增加已起始
- 預測性自動縮放往上增加已完成
- 計量失敗
- 計量復原
- 預測性計量失敗
- 翻動
接下來會顯示每個記錄事件名稱的摘錄內容,其中顯示了 Properties
元素的相關部分。
自動縮放動作
當自動縮放嘗試向內縮小或向外擴充時記錄:
{
"eventCategory": "Autoscale",
"eventName": "AutoscaleAction",
...
"eventProperties": "{
"Description": "The autoscale engine attempting to scale resource '/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan' from 2 instances count to 1 instancescount.",
"ResourceName": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"OldInstancesCount": 2,
"NewInstancesCount": 1,
"ActiveAutoscaleProfile": {
"Name": "Default scale condition",
"Capacity": {
"Minimum": "1",
"Maximum": "5",
"Default": "1"
},
"Rules": [
{
"MetricTrigger": {
"Name": "CpuPercentage",
"Namespace": "microsoft.web/serverfarms",
"Resource": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"ResourceLocation": "West Central US",
"TimeGrain": "PT1M",
"Statistic": "Average",
"TimeWindow": "PT2M",
"TimeAggregation": "Average",
"Operator": "GreaterThan",
"Threshold": 40.0,
"Source": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"MetricType": "MDM",
"Dimensions": [],
"DividePerInstance": false
},
"ScaleAction": {
"Direction": "Increase",
"Type": "ChangeCount",
"Value": "1",
"Cooldown": "PT3M"
}
},
{
"MetricTrigger": {
"Name": "CpuPercentage",
"Namespace": "microsoft.web/serverfarms",
"Resource": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"ResourceLocation": "West Central US",
"TimeGrain": "PT1M",
"Statistic": "Average",
"TimeWindow": "PT5M",
"TimeAggregation": "Average",
"Operator": "LessThanOrEqual",
"Threshold": 30.0,
"Source": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"MetricType": "MDM",
"Dimensions": [],
"DividePerInstance": false
},
"ScaleAction": {
"Direction": "Decrease",
"Type": "ExactCount",
"Value": "1",
"Cooldown": "PT5M"
}
}
]
},
"LastScaleActionTime": "Thu, 26 Jan 2023 12:57:14 GMT"
}",
...
"activityStatusValue": "Succeeded"
}
取得作業狀態結果
在調整事件之後記錄:
"Properties":{
"eventCategory": "Autoscale",
"eventName": "GetOperationStatusResult",
...
"eventProperties": "{"OldInstancesCount":3,"NewInstancesCount":2}",
...
"activityStatusValue": "Succeeded"
}
計量失敗
當自動縮放無法判斷調整規則中所使用的計量值時記錄:
"Properties":{
"eventCategory": "Autoscale",
"eventName": "MetricFailure",
...
"eventProperties": "{
"Notes":"To ensure service availability, Autoscale will scale out the resource to the default capacity if it is greater than the current capacity}",
...
"activityStatusValue": "Failed"
}
計量復原
在 MetricFailure
事件發生後,自動縮放可以再次判斷調整規則中所使用的計量值時記錄:
"Properties":{
"eventCategory": "Autoscale",
"eventName": "MetricRecovery",
...
"eventProperties": "{}",
...
"activityStatusValue": "Succeeded"
}
預測性計量失敗
當自動縮放因為沒有計量而無法計算預測的調整事件時記錄:
"Properties": {
"eventCategory": "Autoscale",
"eventName": "PredictiveMetricFailure",
...
"eventProperties": "{
"Notes": "To ensure service availability, Autoscale will scale out the resource to the default capacity if it is greater than the current capacity"
}",
...
"activityStatusValue": "Failed"
}
發生擺盪情況
當自動縮放偵測到可能會發生擺盪情況 (flapping) 並以不同的方式進行調整以避免此情況時記錄:
"Properties":{
"eventCategory": "Autoscale",
"eventName": "FlappingOccurred",
...
"eventProperties":
"{"Description":"Scale down will occur with updated instance count to avoid flapping.
Resource: '/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan'.
Current instance count: '6',
Intended new instance count: '1'.
Actual new instance count: '4'",
"ResourceName":"/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Web/serverFarms/ScaleableAppServicePlan",
"OldInstancesCount":6,
"NewInstancesCount":4,
"ActiveAutoscaleProfile":{"Name":"Auto created scale condition",
"Capacity":{"Minimum":"1","Maximum":"30","Default":"1"},
"Rules":[{"MetricTrigger":{"Name":"Requests","Namespace":"microsoft.web/sites","Resource":"/subscriptions/ bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/sites/ScaleableWebApp1", "ResourceLocation":"West Central US","TimeGrain":"PT1M","Statistic":"Average","TimeWindow":"PT1M","TimeAggregation":"Maximum", "Operator":"GreaterThanOrEqual","Threshold":3.0,"Source":"/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/ rg-001/providers/Microsoft.Web/sites/ScaleableWebApp1","MetricType":"MDM","Dimensions":[],"DividePerInstance":true}, "ScaleAction":{"Direction":"Increase","Type":"ChangeCount","Value":"10","Cooldown":"PT1M"}},{"MetricTrigger":{"Name":"Requests", "Namespace":"microsoft.web/sites","Resource":"/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/ providers/Microsoft.Web/sites/ScaleableWebApp1","ResourceLocation":"West Central US","TimeGrain":"PT1M","Statistic":"Max", "TimeWindow":"PT1M","TimeAggregation":"Maximum","Operator":"LessThan","Threshold":3.0,"Source":"/subscriptions/ bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/Microsoft.Web/sites/ScaleableWebApp1","MetricType":"MDM", "Dimensions":[],"DividePerInstance":true},"ScaleAction":{"Direction":"Decrease","Type":"ChangeCount","Value":"5", "Cooldown":"PT1M"}}]}}",
...
"activityStatusValue": "Succeeded"
}
翻動
當自動縮放偵測到可能會發生擺盪情況並延遲向內縮小以避免此情況時記錄:
"Properties": {
"eventCategory": "Autoscale",
"eventName": "Flapping",
"Description": "{"Cannot scale down due to flapping observed. Resource: '/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Compute/virtualMachineScaleSets/mac2'. Current instance count: '2', Intended new instance count '1'",
"ResourceName": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourcegroups/rg-001/providers/Microsoft.Compute/virtualMachineScaleSets/mac2",
"OldInstancesCount": "2",
"NewInstancesCount": "2",
"ActiveAutoscaleProfile": "ActiveAutoscaleProfile": {
"Name": "Auto created default scale condition",
"Capacity": {
"Minimum": "1",
"Maximum": "2",
"Default": "1"
},
"Rules": [
{
"MetricTrigger": {
"Name": "StorageSuccesses",
"Namespace": "monitoringbackgroundjob",
"Resource": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/microsoft.monitor/accounts/MACAzureInsightsPROD",
"ResourceLocation": "EastUS2",
"TimeGrain": "PT1M",
"Statistic": "Average",
"TimeWindow": "PT10M",
"TimeAggregation": "Average",
"Operator": "LessThan",
"Threshold": 600.0,
"Source": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-001/providers/microsoft.monitor/accounts/MACAzureInsightsPROD",
"MetricType": "MDM",
"Dimensions": [],
"DividePerInstance": false
},
"ScaleAction": {
"Direction": "Decrease",
"Type": "ChangeCount",
"Value": "1",
"Cooldown": "PT5M"
}
},
{
"MetricTrigger": {
"Name": "TimeToStartupInMs",
"Namespace": "armrpclient",
"Resource": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-123/providers/microsoft.monitor/accounts/MACMetricsRP",
"ResourceLocation": "eastus2",
"TimeGrain": "PT1M",
"Statistic": "Percentile99th",
"TimeWindow": "PT10M",
"TimeAggregation": "Average",
"Operator": "GreaterThan",
"Threshold": 70.0,
"Source": "/subscriptions/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f/resourceGroups/rg-123/providers/microsoft.monitor/accounts/MACMetricsRP",
"MetricType": "MDM",
"Dimensions": [],
"DividePerInstance": false
},
"ScaleAction": {
"Direction": "Increase",
"Type": "ChangeCount",
"Value": "1",
"Cooldown": "PT5M"
}
}
]
}"
}...