Skip to content

Commit

Permalink
Add additional quality checker metric
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Plowman committed Oct 18, 2023
1 parent 342e73a commit 477c214
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion application/change_event_dlq_handler/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aws-embedded-metrics
aws-lambda-powertools[tracer] ~= 2.25.0
aws-lambda-powertools[tracer] ~= 2.26.0
2 changes: 1 addition & 1 deletion application/dos_db_handler/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aws-embedded-metrics
aws-lambda-powertools[tracer] ~= 2.25.0
aws-lambda-powertools[tracer] ~= 2.26.0
psycopg[binary]
2 changes: 1 addition & 1 deletion application/dos_db_update_dlq_handler/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aws-embedded-metrics
aws-lambda-powertools[tracer] ~= 2.25.0
aws-lambda-powertools[tracer] ~= 2.26.0
2 changes: 1 addition & 1 deletion application/event_replay/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aws-embedded-metrics
aws-lambda-powertools[tracer] ~= 2.25.0
aws-lambda-powertools[tracer] ~= 2.26.0
simplejson
2 changes: 1 addition & 1 deletion application/ingest_change_event/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aws-embedded-metrics
aws-lambda-powertools[tracer, validation] ~= 2.25.0
aws-lambda-powertools[tracer, validation] ~= 2.26.0
16 changes: 16 additions & 0 deletions application/quality_checker/reporting.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from os import environ
from typing import Any

from aws_embedded_metrics import metric_scope
from aws_lambda_powertools.logging import Logger

from common.dos import DoSService
Expand Down Expand Up @@ -34,3 +38,15 @@ def log_to_quality_check_report(
"reason": reason,
},
)


@metric_scope
def quality_check_report_metric(metrics: Any) -> None: # noqa: ANN401
"""Send a metric to indicate that the quality checker has found an issue.
Args:
metrics (Metrics): CloudWatch embedded metrics object
"""
metrics.set_namespace("UEC-DOS-INT")
metrics.set_dimensions({"ENV": environ["ENV"]})
metrics.put_metric("QualityCheckerIssueFound", 1, "Count")
2 changes: 1 addition & 1 deletion application/quality_checker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aws-embedded-metrics
aws-lambda-powertools[tracer, validation] ~= 2.25.0
aws-lambda-powertools[tracer, validation] ~= 2.26.0
psycopg[binary]
2 changes: 1 addition & 1 deletion application/send_email/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aws_embedded_metrics
aws-lambda-powertools[tracer] ~= 2.25.0
aws-lambda-powertools[tracer] ~= 2.26.0
2 changes: 1 addition & 1 deletion application/service_matcher/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aws-embedded-metrics
aws-lambda-powertools[tracer] ~= 2.25.0
aws-lambda-powertools[tracer] ~= 2.26.0
psycopg[binary]
pytz
2 changes: 1 addition & 1 deletion application/service_sync/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aws-embedded-metrics
aws-lambda-powertools[tracer] ~= 2.25.0
aws-lambda-powertools[tracer] ~= 2.26.0
psycopg[binary]
pytz
2 changes: 1 addition & 1 deletion application/slack_messenger/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aws-embedded-metrics
aws-lambda-powertools[tracer] ~= 2.25.0
aws-lambda-powertools[tracer] ~= 2.26.0
requests
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ resource "aws_cloudwatch_dashboard" "cloudwatch_monitoring_dashboard" {
[".", "ChangeEventReceived", ".", var.blue_green_environment, { "region" : var.aws_region, "color" : "#1f77b4", "label" : "Change Event Received" }],
[".", "UpdateRequestSent", ".", var.blue_green_environment, { "label" : "Update Requests Sent", "color" : "#b088f5" }],
[".", "DoSAllServiceUpdates", ".", var.blue_green_environment, { "label" : "All DoS Data Item Updates", "color" : "#000000" }],
[".", "QualityCheckerIssueFound", ".", var.blue_green_environment, { "label" : "Quality Checker Issue Found", "color" : "#000000" }],
],
"stacked" : false,
"region" : var.aws_region,
Expand Down

0 comments on commit 477c214

Please sign in to comment.