-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EES-5687 - removed base alert templates for CPU, memory and response …
…times in favour of reusable configuration and direct calls to rejigged dynamicMetricAlert.bicep template which reduces boilerplate from callsites.
- Loading branch information
1 parent
c3cf4b1
commit 7901822
Showing
24 changed files
with
285 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
infrastructure/templates/public-api/components/alerts/appGateways/responseTimeAlert.bicep
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...structure/templates/public-api/components/alerts/appServicePlans/cpuPercentageAlert.bicep
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...ucture/templates/public-api/components/alerts/appServicePlans/memoryPercentageAlert.bicep
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
infrastructure/templates/public-api/components/alerts/baseCpuPercentageAlert.bicep
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
infrastructure/templates/public-api/components/alerts/baseMemoryPercentageAlert.bicep
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
infrastructure/templates/public-api/components/alerts/baseResponseTimeAlert.bicep
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
infrastructure/templates/public-api/components/alerts/config.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var defaultDynamicAlertConfig = { | ||
aggregation: 'Average' | ||
operator: 'GreaterThan' | ||
evaluationFrequency: 'PT5M' | ||
windowSize: 'PT15M' | ||
numberOfEvaluationPeriods: 5 | ||
minFailingPeriodsToAlert: 5 | ||
sensitivity: 'Low' | ||
severity: 'Warning' | ||
} | ||
|
||
@export() | ||
var cpuPercentageConfig = union(defaultDynamicAlertConfig, { | ||
nameSuffix: 'cpu-percentage' | ||
}) | ||
|
||
@export() | ||
var memoryPercentageConfig = union(defaultDynamicAlertConfig, { | ||
nameSuffix: 'memory-percentage' | ||
}) | ||
|
||
@export() | ||
var responseTimeConfig = union(defaultDynamicAlertConfig, { | ||
nameSuffix: 'response-time' | ||
}) |
19 changes: 0 additions & 19 deletions
19
infrastructure/templates/public-api/components/alerts/containerApps/cpuPercentageAlert.bicep
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...tructure/templates/public-api/components/alerts/containerApps/memoryPercentageAlert.bicep
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
infrastructure/templates/public-api/components/alerts/containerApps/responseTimeAlert.bicep
This file was deleted.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
infrastructure/templates/public-api/components/alerts/dynamicMetricAlertNew.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { | ||
EvaluationFrequency | ||
MetricName | ||
DynamicMetricOperator | ||
DynamicAlertConfig | ||
ResourceType | ||
TimeAggregation | ||
WindowSize | ||
Severity | ||
Sensitivity | ||
severityMapping | ||
} from 'types.bicep' | ||
|
||
import { ResourceMetric } from 'resourceMetrics.bicep' | ||
|
||
@description('Name of the resource that this alert is being applied to.') | ||
param resourceName string | ||
|
||
@description(''' | ||
Optional id of the resource that this alert is being applied to, | ||
if it cannot be looked up by the combination of resourceName and resourceType. | ||
''') | ||
param id string? | ||
|
||
@description('Resource type and metric name combination.') | ||
param resourceMetric ResourceMetric | ||
|
||
@description('Configuration for this dynamic alert.') | ||
param config DynamicAlertConfig | ||
|
||
@description(''' | ||
An optional date that prevents machine learning algorithms from using metric data prior to this date in order to | ||
calculate its dynamic threshold. | ||
''') | ||
param ignoreDataBefore string? | ||
|
||
@description('Name of the Alerts Group used to send alert messages.') | ||
param alertsGroupName string | ||
|
||
@description('Tags with which to tag the resource in Azure.') | ||
param tagValues object | ||
|
||
var severityLevel = severityMapping[config.severity] | ||
|
||
var resourceIds = [id != null ? id! : resourceId(resourceMetric.resourceType, resourceName)] | ||
|
||
resource alertsActionGroup 'Microsoft.Insights/actionGroups@2023-01-01' existing = { | ||
name: alertsGroupName | ||
} | ||
|
||
resource metricAlertRule 'Microsoft.Insights/metricAlerts@2018-03-01' = { | ||
name: '${resourceName}-${config.nameSuffix}' | ||
location: 'Global' | ||
properties: { | ||
enabled: true | ||
scopes: resourceIds | ||
severity: severityLevel | ||
evaluationFrequency: config.evaluationFrequency | ||
windowSize: config.windowSize | ||
criteria: { | ||
'odata.type': 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria' | ||
allOf: [ | ||
{ | ||
criterionType: 'DynamicThresholdCriterion' | ||
name: 'Metric1' | ||
metricName: resourceMetric.metric | ||
metricNamespace: resourceMetric.resourceType | ||
timeAggregation: config.aggregation | ||
operator: config.operator | ||
alertSensitivity: config.sensitivity | ||
skipMetricValidation: false | ||
failingPeriods: { | ||
minFailingPeriodsToAlert: config.minFailingPeriodsToAlert | ||
numberOfEvaluationPeriods: config.numberOfEvaluationPeriods | ||
} | ||
ignoreDataBefore: ignoreDataBefore | ||
} | ||
] | ||
} | ||
actions: [ | ||
{ | ||
actionGroupId: alertsActionGroup.id | ||
} | ||
] | ||
} | ||
tags: tagValues | ||
} |
32 changes: 0 additions & 32 deletions
32
infrastructure/templates/public-api/components/alerts/fileServices/latencyAlert.bicep
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.