Skip to content

Commit

Permalink
EES-5686 - responding to PR comments. Adding descriptions to all dyna…
Browse files Browse the repository at this point in the history
…micMetricAlert.bicep params that were missing descriptions. Formatted file for cleaner import block.
  • Loading branch information
duncan-at-hiveit committed Dec 19, 2024
1 parent 2a9f1ac commit aaaccaf
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { EvaluationFrequency, MetricName, DynamicMetricOperator, ResourceType, TimeAggregation, WindowSize, Severity, Sensitivity, severityMapping } from 'types.bicep'
import {
EvaluationFrequency
MetricName
DynamicMetricOperator
ResourceType
TimeAggregation
WindowSize
Severity
Sensitivity
severityMapping
} from 'types.bicep'

@description('Name of the alert.')
param alertName string
Expand All @@ -16,21 +26,50 @@ param query {
operator: DynamicMetricOperator
}

@description('The evaluation frequency.')
@description('''
The frequency with which this alert rule evaluates the metrics against the dynamic thresholds.
For instance, PT1M with a window size of PT5M will evaluate the past 5 minutes' worth of metric data
against the dynamic threshold every minute.
''')
param evaluationFrequency EvaluationFrequency = 'PT1M'

@description('The window size.')
@description('''
The timespan that is used to calculate the metric's value against the specified time aggregation.
For instance, PT5M with a time aggregation of "Average" will use 5 minutes of metric data to calculate
the average value, which is then compared to the dynamic threshold.
''')
param windowSize WindowSize = 'PT5M'

@description('''
How sensitive the alert is if a metric exceeds its dynamic threshold.
Low sensitivity means that this alert will fire only if the metric exceeds the threshold by a high degree.
High sensitivity means that this alert will fire if the metric exceeds the threshold to a much lower degree.
''')
param sensitivity Sensitivity = 'Low'

@description('''
How many periods to look back over to count failing periods. Used in conjunction with "minFailingPeriodsToAlert".
As an example, if "numberOfEvaluationPeriods" is set to 5 and "evaluationFrequency" is set to every minute, the past
5 alerts (one for each of the last 5 minutes) is looked at and each failure is counted up.
''')
param numberOfEvaluationPeriods int = 5

@description('''
How many of the "numberOfEvaluationPeriods" results need to have failed in order for this rule to fire.
For instance, if this rule is using the past 5 calculations (with "numberOfEvaluationPeriods" set to 5) to evaluate
whether or not to fire, "minFailingPeriodsToAlert" determines how many of those past 5 periods have to have failed
in order for this rule to fire. If this was set to 3, 3 out of the 5 past calculations will have had to fail in
order for this rule to fire.
''')
param minFailingPeriodsToAlert int = 5

@description('The alert severity.')
param severity Severity = 'Error'

param sensitivity Sensitivity = 'High'

param minFailingPeriodsToAlert int = 1

param numberOfEvaluationPeriods int = 1

@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.')
Expand All @@ -55,22 +94,24 @@ resource metricAlertRule 'Microsoft.Insights/metricAlerts@2018-03-01' = {
evaluationFrequency: evaluationFrequency
windowSize: windowSize
criteria: {
'odata.type': 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria'
allOf: [{
criterionType: 'DynamicThresholdCriterion'
name: 'Metric1'
metricName: query.metric
metricNamespace: resourceType
timeAggregation: query.aggregation
operator: query.operator
alertSensitivity: sensitivity
skipMetricValidation: false
failingPeriods: {
minFailingPeriodsToAlert: minFailingPeriodsToAlert
numberOfEvaluationPeriods: numberOfEvaluationPeriods
'odata.type': 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria'
allOf: [
{
criterionType: 'DynamicThresholdCriterion'
name: 'Metric1'
metricName: query.metric
metricNamespace: resourceType
timeAggregation: query.aggregation
operator: query.operator
alertSensitivity: sensitivity
skipMetricValidation: false
failingPeriods: {
minFailingPeriodsToAlert: minFailingPeriodsToAlert
numberOfEvaluationPeriods: numberOfEvaluationPeriods
}
ignoreDataBefore: ignoreDataBefore
}
ignoreDataBefore: ignoreDataBefore
}]
]
}
actions: [
{
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
"pipenv run flake8",
"pipenv run black",
"pipenv run isort"
],
"*.{scss,css}": [
"stylelint"
]
}
}

0 comments on commit aaaccaf

Please sign in to comment.