Update Function Scaling Policy and Diagnostic Settings. (#2140)

* Update Function Scaling Policy and Diagnostic Settings.

* Adding changes to scaling policy

* UPdating cooldown.

* Changing time windows.

* Updating duration.
This commit is contained in:
Noah McGregor Harper
2022-07-08 12:03:14 -07:00
committed by GitHub
parent 34a8d721bb
commit 28e42ab8e8
4 changed files with 41 additions and 20 deletions

View File

@ -62,6 +62,17 @@ resource scalesetIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018
location: location
}
module operationalInsights 'bicep-templates/operational-insights.bicep' = {
name: 'operational-insights'
params: {
name: name
location: location
log_retention: log_retention
owner: owner
workbookData: workbookData
}
}
module serverFarms 'bicep-templates/server-farms.bicep' = {
name: 'server-farms'
params: {
@ -138,17 +149,8 @@ module autoscaleSettings 'bicep-templates/autoscale-settings.bicep' = {
location: location
server_farm_id: serverFarms.outputs.id
owner: owner
}
}
module operationalInsights 'bicep-templates/operational-insights.bicep' = {
name: 'operational-insights'
params: {
name: name
location: location
log_retention: log_retention
owner: owner
workbookData: workbookData
workspaceId: operationalInsights.outputs.workspaceId
logRetention: log_retention
}
}
@ -373,7 +375,6 @@ module netFunctionSettings 'bicep-templates/function-settings.bicep' = {
]
}
output fuzz_storage string = storage.outputs.FuzzId
output fuzz_name string = storage.outputs.FuzzName
output fuzz_key string = storage.outputs.FuzzKey

View File

@ -1,6 +1,8 @@
param location string
param server_farm_id string
param owner string
param workspaceId string
param logRetention int
var autoscale_name = 'onefuzz-autoscale-${uniqueString(resourceGroup().id)}'
@ -28,16 +30,16 @@ resource autoscaleSettings 'Microsoft.Insights/autoscalesettings@2015-04-01' = {
metricResourceUri: server_farm_id
operator: 'GreaterThanOrEqual'
statistic: 'Average'
threshold: 20
threshold: 50
timeAggregation: 'Average'
timeGrain: 'PT1M'
timeWindow: 'PT1M'
timeWindow: 'PT10M'
}
scaleAction: {
cooldown: 'PT1M'
cooldown: 'PT10M'
direction: 'Increase'
type: 'ChangeCount'
value: '5'
value: '1'
}
}
{
@ -46,13 +48,13 @@ resource autoscaleSettings 'Microsoft.Insights/autoscalesettings@2015-04-01' = {
metricResourceUri: server_farm_id
operator: 'LessThan'
statistic: 'Average'
threshold: 20
threshold: 25
timeAggregation:'Average'
timeGrain: 'PT1M'
timeWindow: 'PT1M'
timeWindow: 'PT10M'
}
scaleAction: {
cooldown: 'PT5M'
cooldown: 'PT10M'
direction: 'Decrease'
type: 'ChangeCount'
value: '1'
@ -67,3 +69,21 @@ resource autoscaleSettings 'Microsoft.Insights/autoscalesettings@2015-04-01' = {
OWNER: owner
}
}
resource functionDiagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
name: 'functionDiagnosticSettings'
scope: autoscaleSettings
properties: {
logs: [
{
categoryGroup: 'allLogs'
enabled: true
retentionPolicy: {
days: logRetention
enabled: true
}
}
]
workspaceId: workspaceId
}
}

View File

@ -165,3 +165,4 @@ resource insightsWorkbooks 'Microsoft.Insights/workbooks@2021-08-01' = {
output monitorAccountName string = monitorAccountName
output appInsightsAppId string = insightsComponents.properties.AppId
output appInsightsInstrumentationKey string = insightsComponents.properties.InstrumentationKey
output workspaceId string = resourceId('Microsoft.OperationalInsights/workspaces', monitorAccountName)

View File

@ -20,5 +20,4 @@ resource serverFarms 'Microsoft.Web/serverfarms@2021-03-01' = {
}
}
output id string = serverFarms.id