Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: [AEA-4490] - Add an alarm on Dynamo capacity #939

Merged
merged 9 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions SAMtemplates/alarms/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Parameters:
EnableAlerts:
Type: String

DynamoDBUtilizationPercentageThreshold:
Type: Number
Description: When the database usage crosses this percentage of provisioned capacity, trigger an alarm
Default: 90

Resources:
GetStatusUpdatesErrorsLogsMetricFilter:
Type: AWS::Logs::MetricFilter
Expand Down Expand Up @@ -220,6 +225,49 @@ Resources:
OKActions:
- !ImportValue lambda-resources:SlackAlertsSnsTopicArn

DynamoDBWriteConsumptionAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: !Sub "${AWS::StackName}_DynamoDB_ConsumedWriteCapacity"
ActionsEnabled: !Ref EnableAlerts
AlarmActions:
- !ImportValue lambda-resources:SlackAlertsSnsTopicArn
InsufficientDataActions:
- !ImportValue lambda-resources:SlackAlertsSnsTopicArn
OKActions:
- !ImportValue lambda-resources:SlackAlertsSnsTopicArn
EvaluationPeriods: 1
Threshold: !Ref DynamoDBUtilizationPercentageThreshold
ComparisonOperator: GreaterThanOrEqualToThreshold
TreatMissingData: notBreaching
Metrics:
- Id: e1
Label: UtilizationPercentage
ReturnData: true
Expression: "(m1 / (m2 * 60)) * 100"
- Id: m1
ReturnData: false
MetricStat:
Metric:
Namespace: AWS/DynamoDB
MetricName: ConsumedWriteCapacityUnits
Dimensions:
- Name: TableName
Value: !Ref PrescriptionStatusUpdatesTableName
Period: 60
Stat: Sum
- Id: m2
ReturnData: false
MetricStat:
Metric:
Namespace: AWS/DynamoDB
MetricName: ProvisionedWriteCapacityUnits
Dimensions:
- Name: TableName
Value: !Ref PrescriptionStatusUpdatesTableName
Period: 60
Stat: Maximum

CPSUFhirConverterErrorLogsMetricFilter:
Type: AWS::Logs::MetricFilter
Properties:
Expand Down
7 changes: 7 additions & 0 deletions SAMtemplates/main_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ Parameters:
- true
- false

DynamoDBUtilizationPercentageThreshold:
Type: Number
Description: When the database usage crosses this percentage of provisioned capacity, trigger an alarm
Default: 90


Resources:
Tables:
Type: AWS::Serverless::Application
Expand Down Expand Up @@ -150,4 +156,5 @@ Resources:
UpdatePrescriptionStatusFunctionName: !GetAtt Functions.Outputs.UpdatePrescriptionStatusFunctionName
PrescriptionStatusUpdatesTableName: !GetAtt Tables.Outputs.PrescriptionStatusUpdatesTableName
ConvertRequestToFhirFormatFunctionName: !GetAtt Functions.Outputs.ConvertRequestToFhirFormatFunctionName
DynamoDBUtilizationPercentageThreshold: !Ref DynamoDBUtilizationPercentageThreshold
EnableAlerts: !Ref EnableAlerts
23 changes: 5 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.