From 477c2142543025a82b9466e834268051a699dfff Mon Sep 17 00:00:00 2001 From: Jack Plowman Date: Wed, 18 Oct 2023 16:21:56 +0100 Subject: [PATCH] Add additional quality checker metric --- .../change_event_dlq_handler/requirements.txt | 2 +- application/dos_db_handler/requirements.txt | 2 +- .../dos_db_update_dlq_handler/requirements.txt | 2 +- application/event_replay/requirements.txt | 2 +- application/ingest_change_event/requirements.txt | 2 +- application/quality_checker/reporting.py | 16 ++++++++++++++++ application/quality_checker/requirements.txt | 2 +- application/send_email/requirements.txt | 2 +- application/service_matcher/requirements.txt | 2 +- application/service_sync/requirements.txt | 2 +- application/slack_messenger/requirements.txt | 2 +- .../blue-green-link/cloudwatch-dashboards.tf | 1 + 12 files changed, 27 insertions(+), 10 deletions(-) diff --git a/application/change_event_dlq_handler/requirements.txt b/application/change_event_dlq_handler/requirements.txt index dd7dc41e8..ed8583b5a 100644 --- a/application/change_event_dlq_handler/requirements.txt +++ b/application/change_event_dlq_handler/requirements.txt @@ -1,2 +1,2 @@ aws-embedded-metrics -aws-lambda-powertools[tracer] ~= 2.25.0 +aws-lambda-powertools[tracer] ~= 2.26.0 diff --git a/application/dos_db_handler/requirements.txt b/application/dos_db_handler/requirements.txt index 16cea1bea..9e12c7811 100644 --- a/application/dos_db_handler/requirements.txt +++ b/application/dos_db_handler/requirements.txt @@ -1,3 +1,3 @@ aws-embedded-metrics -aws-lambda-powertools[tracer] ~= 2.25.0 +aws-lambda-powertools[tracer] ~= 2.26.0 psycopg[binary] diff --git a/application/dos_db_update_dlq_handler/requirements.txt b/application/dos_db_update_dlq_handler/requirements.txt index dd7dc41e8..ed8583b5a 100644 --- a/application/dos_db_update_dlq_handler/requirements.txt +++ b/application/dos_db_update_dlq_handler/requirements.txt @@ -1,2 +1,2 @@ aws-embedded-metrics -aws-lambda-powertools[tracer] ~= 2.25.0 +aws-lambda-powertools[tracer] ~= 2.26.0 diff --git a/application/event_replay/requirements.txt b/application/event_replay/requirements.txt index e82401e1a..e54b3c481 100644 --- a/application/event_replay/requirements.txt +++ b/application/event_replay/requirements.txt @@ -1,3 +1,3 @@ aws-embedded-metrics -aws-lambda-powertools[tracer] ~= 2.25.0 +aws-lambda-powertools[tracer] ~= 2.26.0 simplejson diff --git a/application/ingest_change_event/requirements.txt b/application/ingest_change_event/requirements.txt index 9716b1fa2..48a1053b7 100644 --- a/application/ingest_change_event/requirements.txt +++ b/application/ingest_change_event/requirements.txt @@ -1,2 +1,2 @@ aws-embedded-metrics -aws-lambda-powertools[tracer, validation] ~= 2.25.0 +aws-lambda-powertools[tracer, validation] ~= 2.26.0 diff --git a/application/quality_checker/reporting.py b/application/quality_checker/reporting.py index d1950d10e..e79bae55d 100644 --- a/application/quality_checker/reporting.py +++ b/application/quality_checker/reporting.py @@ -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 @@ -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") diff --git a/application/quality_checker/requirements.txt b/application/quality_checker/requirements.txt index de878d13f..f760cc817 100644 --- a/application/quality_checker/requirements.txt +++ b/application/quality_checker/requirements.txt @@ -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] diff --git a/application/send_email/requirements.txt b/application/send_email/requirements.txt index 2041ba0f4..d40c7e227 100644 --- a/application/send_email/requirements.txt +++ b/application/send_email/requirements.txt @@ -1,2 +1,2 @@ aws_embedded_metrics -aws-lambda-powertools[tracer] ~= 2.25.0 +aws-lambda-powertools[tracer] ~= 2.26.0 diff --git a/application/service_matcher/requirements.txt b/application/service_matcher/requirements.txt index 2dd27de41..84021cc0f 100644 --- a/application/service_matcher/requirements.txt +++ b/application/service_matcher/requirements.txt @@ -1,4 +1,4 @@ aws-embedded-metrics -aws-lambda-powertools[tracer] ~= 2.25.0 +aws-lambda-powertools[tracer] ~= 2.26.0 psycopg[binary] pytz diff --git a/application/service_sync/requirements.txt b/application/service_sync/requirements.txt index 2dd27de41..84021cc0f 100644 --- a/application/service_sync/requirements.txt +++ b/application/service_sync/requirements.txt @@ -1,4 +1,4 @@ aws-embedded-metrics -aws-lambda-powertools[tracer] ~= 2.25.0 +aws-lambda-powertools[tracer] ~= 2.26.0 psycopg[binary] pytz diff --git a/application/slack_messenger/requirements.txt b/application/slack_messenger/requirements.txt index 95f0df0bf..30d14624a 100644 --- a/application/slack_messenger/requirements.txt +++ b/application/slack_messenger/requirements.txt @@ -1,3 +1,3 @@ aws-embedded-metrics -aws-lambda-powertools[tracer] ~= 2.25.0 +aws-lambda-powertools[tracer] ~= 2.26.0 requests diff --git a/infrastructure/stacks/blue-green-link/cloudwatch-dashboards.tf b/infrastructure/stacks/blue-green-link/cloudwatch-dashboards.tf index 51236527b..0dad36fa4 100644 --- a/infrastructure/stacks/blue-green-link/cloudwatch-dashboards.tf +++ b/infrastructure/stacks/blue-green-link/cloudwatch-dashboards.tf @@ -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,