From 28aedd9100d79e48f6b71e68f59cc48154ea1424 Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Fri, 8 Dec 2023 01:25:32 -0500 Subject: [PATCH 1/3] Add support for AWS Account ID in s3 fast sync bucket --- indexer/indexer_monitors.tf | 1 + indexer/variables.tf | 6 ++++++ modules/indexer_monitors/locals.tf | 1 + modules/indexer_monitors/monitors.tf | 2 +- modules/indexer_monitors/variables.tf | 5 +++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/indexer/indexer_monitors.tf b/indexer/indexer_monitors.tf index ebbceb7b..8f1aee5c 100644 --- a/indexer/indexer_monitors.tf +++ b/indexer/indexer_monitors.tf @@ -11,4 +11,5 @@ module "indexer_monitors" { team = var.monitoring_team url = var.indexer_url enable_precautionary_monitors = var.enable_precautionary_monitors + aws_account_id = var.monitoring_aws_account_id } diff --git a/indexer/variables.tf b/indexer/variables.tf index 416a412f..192754c4 100644 --- a/indexer/variables.tf +++ b/indexer/variables.tf @@ -332,6 +332,12 @@ variable "monitoring_team" { default = "v4-indexer" } +variable "monitoring_aws_account_id" { + type = string + description = "Account ID for the AWS account" + default = "" +} + variable "enable_precautionary_monitors" { type = bool description = "Whether to enable precautionary monitors" diff --git a/modules/indexer_monitors/locals.tf b/modules/indexer_monitors/locals.tf index 0552411d..e58b6d1f 100644 --- a/modules/indexer_monitors/locals.tf +++ b/modules/indexer_monitors/locals.tf @@ -6,6 +6,7 @@ locals { tick_frequency = 300 # 5 minutes retry_interval = 3000 # 3 seconds in milliseconds retry_count = 3 # 3 retries + bucket_prefix = var.aws_account_id == "" ? var.environment : "${var.aws_account_id}-${var.environment}" api_http_synthetic_monitor_configurations = { "height" : { diff --git a/modules/indexer_monitors/monitors.tf b/modules/indexer_monitors/monitors.tf index 13952231..15f67941 100644 --- a/modules/indexer_monitors/monitors.tf +++ b/modules/indexer_monitors/monitors.tf @@ -198,7 +198,7 @@ resource "datadog_monitor_json" "fast_sync_snapshots" { "id": 131752782, "name": "[${var.environment}] Indexer fast sync snapshots haven't been uploaded in the last day", "type": "query alert", - "query": "sum(last_1d):sum:aws.s3.put_requests{bucketname:${var.environment}-full-node-snapshots}.as_count() < 1", + "query": "sum(last_1d):sum:aws.s3.put_requests{bucketname:${local.bucket_prefix}-full-node-snapshots}.as_count() < 1", "message": "Indexer fast sync snapshots haven't been uploaded in the last day. Please investigate the snapshotting full node.\n\n${local.monitor_suffix_literal}", "tags": [ "team:${var.team}", diff --git a/modules/indexer_monitors/variables.tf b/modules/indexer_monitors/variables.tf index e7d3b0e2..b66626b6 100644 --- a/modules/indexer_monitors/variables.tf +++ b/modules/indexer_monitors/variables.tf @@ -42,3 +42,8 @@ variable "enable_precautionary_monitors" { type = bool description = "Whether to enable precautionary monitors" } + +variable "aws_account_id" { + type = string + description = "Account ID for the AWS account" +} From b9da144812444e60243e6c9dbb5ec63ece3423cd Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Fri, 8 Dec 2023 01:52:47 -0500 Subject: [PATCH 2/3] lint --- modules/indexer_monitors/locals.tf | 2 +- modules/indexer_monitors/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/indexer_monitors/locals.tf b/modules/indexer_monitors/locals.tf index e58b6d1f..cce26bda 100644 --- a/modules/indexer_monitors/locals.tf +++ b/modules/indexer_monitors/locals.tf @@ -6,7 +6,7 @@ locals { tick_frequency = 300 # 5 minutes retry_interval = 3000 # 3 seconds in milliseconds retry_count = 3 # 3 retries - bucket_prefix = var.aws_account_id == "" ? var.environment : "${var.aws_account_id}-${var.environment}" + bucket_prefix = var.aws_account_id == "" ? var.environment : "${var.aws_account_id}-${var.environment}" api_http_synthetic_monitor_configurations = { "height" : { diff --git a/modules/indexer_monitors/variables.tf b/modules/indexer_monitors/variables.tf index b66626b6..935322a7 100644 --- a/modules/indexer_monitors/variables.tf +++ b/modules/indexer_monitors/variables.tf @@ -44,6 +44,6 @@ variable "enable_precautionary_monitors" { } variable "aws_account_id" { - type = string + type = string description = "Account ID for the AWS account" } From 17bd56731f283f275a19acf0cd7f27dd85a2586e Mon Sep 17 00:00:00 2001 From: Christopher Li Date: Fri, 8 Dec 2023 13:41:44 -0500 Subject: [PATCH 3/3] nits --- modules/indexer_monitors/locals.tf | 2 +- modules/indexer_monitors/monitors.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/indexer_monitors/locals.tf b/modules/indexer_monitors/locals.tf index cce26bda..57d283c3 100644 --- a/modules/indexer_monitors/locals.tf +++ b/modules/indexer_monitors/locals.tf @@ -6,7 +6,7 @@ locals { tick_frequency = 300 # 5 minutes retry_interval = 3000 # 3 seconds in milliseconds retry_count = 3 # 3 retries - bucket_prefix = var.aws_account_id == "" ? var.environment : "${var.aws_account_id}-${var.environment}" + snapshot_bucket_prefix = var.aws_account_id == "" ? var.environment : "${var.aws_account_id}-${var.environment}" api_http_synthetic_monitor_configurations = { "height" : { diff --git a/modules/indexer_monitors/monitors.tf b/modules/indexer_monitors/monitors.tf index 15f67941..b2cc37f3 100644 --- a/modules/indexer_monitors/monitors.tf +++ b/modules/indexer_monitors/monitors.tf @@ -198,7 +198,7 @@ resource "datadog_monitor_json" "fast_sync_snapshots" { "id": 131752782, "name": "[${var.environment}] Indexer fast sync snapshots haven't been uploaded in the last day", "type": "query alert", - "query": "sum(last_1d):sum:aws.s3.put_requests{bucketname:${local.bucket_prefix}-full-node-snapshots}.as_count() < 1", + "query": "sum(last_1d):sum:aws.s3.put_requests{bucketname:${local.snapshot_bucket_prefix}-full-node-snapshots}.as_count() < 1", "message": "Indexer fast sync snapshots haven't been uploaded in the last day. Please investigate the snapshotting full node.\n\n${local.monitor_suffix_literal}", "tags": [ "team:${var.team}",