Skip to content

Commit

Permalink
Merge branch 'main' into aea-4506-migrate-qc
Browse files Browse the repository at this point in the history
  • Loading branch information
wildjames authored Oct 23, 2024
2 parents 7556121 + 9e7ffd0 commit 577d153
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 9 deletions.
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
16 changes: 8 additions & 8 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jsonpath-rw = "^1.4.0"
semver = "^3.0.2"
gitpython = "^3.1.42"
requests = "^2.32.3"
boto3 = "^1.35.44"
boto3 = "^1.35.45"
argparse = "^1.4.0"
pre-commit = "^4.0.1"
pytest = "^8.3.3"
Expand Down

0 comments on commit 577d153

Please sign in to comment.