Skip to content

Commit

Permalink
Fjernet exception handling fra bicep filer
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Todorov committed Oct 30, 2024
1 parent 1f46dc8 commit bf737c6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
1 change: 0 additions & 1 deletion .azure/infrastructure/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ module containerAppEnv '../modules/containerAppEnvironment/main.bicep' = {
location: location
namePrefix: namePrefix
storageAccountName: storageAccountName
emailReceiver: notificationEmail
}
}
output resourceGroupName string = resourceGroup.name
Expand Down
51 changes: 0 additions & 51 deletions .azure/modules/containerAppEnvironment/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ param namePrefix string
param keyVaultName string
param storageAccountName string
@secure()
param emailReceiver string

resource log_analytics_workspace 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
name: '${namePrefix}-log'
Expand Down Expand Up @@ -89,56 +88,6 @@ module storageAccountConnectionStringSecret '../keyvault/upsertSecret.bicep' = {
}
}

resource application_insights_action 'Microsoft.Insights/actionGroups@2023-01-01' = if (emailReceiver != null && emailReceiver != '') {
name: '${namePrefix}-action'
location: 'global' // action group locations is limited, change to use location variable when new locations is added
dependsOn: [application_insights, containerAppEnvironment]
properties: {
groupShortName: 'corr-alert'
enabled: true
emailReceivers: [
{
name: 'emailReceiverForAlert'
emailAddress: emailReceiver
}
]
}
}

resource exceptionOccuredAlertRule 'Microsoft.Insights/scheduledQueryRules@2023-03-15-preview' = if (emailReceiver != null && emailReceiver != '') {
name: '${namePrefix}-500-exception-occured'
location: location
properties: {
description: 'Alert for 500 errors in correspondence'
enabled: true
severity: 1
evaluationFrequency: 'PT5M'
windowSize: 'PT5M'
scopes: [log_analytics_workspace.id]
autoMitigate: false
targetResourceTypes: [
'microsoft.insights/components'
]
criteria: {
allOf: [
{
query: 'AppExceptions | where Properties.StatusCode startswith "5" '
operator: 'GreaterThan'
threshold: 0
timeAggregation: 'Count'
failingPeriods: {
numberOfEvaluationPeriods: 1
minFailingPeriodsToAlert: 1
}
}
]
}
actions: {
actionGroups: [
application_insights_action.id
]
}
}
}

output containerAppEnvironmentId string = containerAppEnvironment.id

0 comments on commit bf737c6

Please sign in to comment.