Skip to content

Commit

Permalink
Add support for AWS Account ID in s3 fast sync bucket (#58)
Browse files Browse the repository at this point in the history
* Add support for AWS Account ID in s3 fast sync bucket

* lint

* nits
  • Loading branch information
Christopher-Li authored Dec 8, 2023
1 parent e72d57c commit 332d90d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions indexer/indexer_monitors.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 6 additions & 0 deletions indexer/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions modules/indexer_monitors/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ locals {
tick_frequency = 300 # 5 minutes
retry_interval = 3000 # 3 seconds in milliseconds
retry_count = 3 # 3 retries
snapshot_bucket_prefix = var.aws_account_id == "" ? var.environment : "${var.aws_account_id}-${var.environment}"

api_http_synthetic_monitor_configurations = {
"height" : {
Expand Down
2 changes: 1 addition & 1 deletion modules/indexer_monitors/monitors.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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.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}",
Expand Down
5 changes: 5 additions & 0 deletions modules/indexer_monitors/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 332d90d

Please sign in to comment.