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

Metrics feature flag clean up #1181

Merged
merged 9 commits into from
Jul 31, 2023
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
35 changes: 0 additions & 35 deletions .happy/terraform/modules/cloudwatch-alarm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,6 @@ resource aws_cloudwatch_log_metric_filter backend_plugin_update_successful {
}
}

resource aws_cloudwatch_log_metric_filter backend_metrics_update_successful {
name = "${var.stack_name}-backend-metrics-update-successful"
log_group_name = var.backend_lambda_log_group_name
pattern = "Completed data refresh for metrics successfully"
count = var.metrics_enabled ? 1 : 0

metric_transformation {
name = "${var.stack_name}-backend-metrics-update-successful"
namespace = local.metrics_namespace
value = "1"
unit = "Count"
}
}

resource aws_cloudwatch_log_metric_filter data_workflows_metrics_update_successful {
name = "${var.stack_name}-data-workflows-metrics-update-successful"
log_group_name = var.data_workflows_lambda_log_group_name
Expand Down Expand Up @@ -116,7 +102,6 @@ resource aws_cloudwatch_log_metric_filter data_workflows_plugin_update_successfu
locals {
backend_api_500_log_metric_name = var.metrics_enabled ? aws_cloudwatch_log_metric_filter.backend_api_500_log_metric[0].name : "backend_api_500_log_metric"
backend_plugin_update_successful_name = var.metrics_enabled ? aws_cloudwatch_log_metric_filter.backend_plugin_update_successful[0].name : "backend_plugin_update_successful"
backend_metrics_update_successful_name = var.metrics_enabled ? aws_cloudwatch_log_metric_filter.backend_metrics_update_successful[0].name : "backend_metrics_update_successful"
data_workflows_metrics_update_successful_name = var.metrics_enabled ? aws_cloudwatch_log_metric_filter.data_workflows_metrics_update_successful[0].name : "data_workflows_metrics_update_successful"
data_workflows_plugin_update_successful_name = var.metrics_enabled ? aws_cloudwatch_log_metric_filter.data_workflows_plugin_update_successful[0].name : "data_workflows_plugin_update_successful"
}
Expand Down Expand Up @@ -180,26 +165,6 @@ module data_workflow_plugins_missing_update_alarm {
treat_missing_data = "breaching"
}

module backend_metrics_missing_update_alarm {
source = "terraform-aws-modules/cloudwatch/aws//modules/metric-alarm"
version = "3.3.0"

alarm_actions = [local.alarm_sns_arn]
alarm_name = "${var.stack_name}-backend-metrics-missing-update-alarm"
alarm_description = "Metrics update failure for backend"
comparison_operator = "LessThanThreshold"
create_metric_alarm = var.alarms_enabled
datapoints_to_alarm = 1
evaluation_periods = 1
metric_name = local.backend_metrics_update_successful_name
namespace = local.metrics_namespace
period = 86400
statistic = "Sum"
tags = var.tags
threshold = 1
treat_missing_data = "breaching"
}

module data_workflows_metrics_missing_update_alarm {
source = "terraform-aws-modules/cloudwatch/aws//modules/metric-alarm"
version = "3.3.0"
Expand Down
18 changes: 0 additions & 18 deletions .happy/terraform/modules/ecs-stack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ module backend_lambda {
"DD_SERVICE" = local.custom_stack_name
"API_URL" = var.env == "dev" ? module.api_gateway_proxy_stage.invoke_url : ""
"PLUGINS_LAMBDA_NAME" = local.plugins_function_name
"SNOWFLAKE_USER" = local.snowflake_user
"SNOWFLAKE_PASSWORD" = local.snowflake_password
"API_KEY" = random_uuid.api_key.result
"STACK_NAME" = local.custom_stack_name
}
Expand Down Expand Up @@ -439,18 +437,6 @@ resource "aws_cloudwatch_event_rule" "activity_rule" {
tags = var.tags
}

resource "aws_cloudwatch_event_target" "activity_target" {
rule = aws_cloudwatch_event_rule.activity_rule.name
arn = module.backend_lambda.function_arn
input_transformer {
input_template = jsonencode({
path = "/activity/update",
httpMethod = "POST",
headers = {"X-API-Key": random_uuid.api_key.result}
})
}
}

resource aws_cloudwatch_event_target activity_target_sqs {
rule = aws_cloudwatch_event_rule.activity_rule.name
arn = aws_sqs_queue.data_workflows_queue.arn
Expand All @@ -469,10 +455,6 @@ locals {
service = "events"
source_arn = aws_cloudwatch_event_rule.update_rule.arn
},
AllowExecutionFromCloudWatchForActivity = {
service = "events"
source_arn = aws_cloudwatch_event_rule.activity_rule.arn
}
}
}

Expand Down
224 changes: 0 additions & 224 deletions backend/api/_tests/test_activity_dashboard.py

This file was deleted.

7 changes: 3 additions & 4 deletions backend/api/_tests/test_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import pandas as pd
from dateutil.relativedelta import relativedelta
from datetime import datetime
from datetime import datetime, date, timezone

BASE = datetime.today().date().replace(day=1)
BASE = datetime.combine(date.today(), datetime.min.time()).replace(day=1, tzinfo=timezone.utc)


def _to_timestamp(i):
return int(pd.Timestamp(BASE + relativedelta(months=i)).timestamp()) * 1000
return int((BASE + relativedelta(months=i)).timestamp()) * 1000


def _generate_timeline(start_range, value_key, to_value, timestamp_key='timestamp'):
Expand Down
Loading