Skip to content

Commit f29e0ec

Browse files
feat: add alerts for onhost canaries [NR-374147] (#1120)
1 parent c635b1d commit f29e0ec

File tree

23 files changed

+290
-94
lines changed

23 files changed

+290
-94
lines changed

.github/workflows/component_onhost_canaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
uses: newrelic/fargate-runner-action@main
4848
with:
4949
aws_region: us-east-2
50-
container_make_target: "TERRAFORM_DIR=test/onhost-canaries/terraform ANSIBLE_FOLDER=test/onhost-canaries/ansible ENVIRONMENT=${{ inputs.environment }} test/onhost-canaries/terraform-${{ inputs.operation }}"
50+
container_make_target: "TERRAFORM_DIR=test/onhost-canaries/terraform ONHOST_ANSIBLE_FOLDER=test/onhost-canaries/ansible ENVIRONMENT=${{ inputs.environment }} test/onhost-canaries/terraform-${{ inputs.operation }}"
5151
ecs_cluster_name: agent_control
5252
task_definition_name: agent_control
5353
cloud_watch_logs_group_name: /ecs/test-prerelease-agent_control

.github/workflows/push_pr_onhost_canaries_apply.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ concurrency:
1515

1616
jobs:
1717
onhost_canaries:
18-
matrix:
19-
environment: [ staging, production ]
18+
strategy:
19+
matrix:
20+
environment: [ staging, production ]
2021

2122
uses: ./.github/workflows/component_onhost_canaries.yml
2223
with:

.github/workflows/push_pr_onhost_canaries_plan.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ concurrency:
1313

1414
jobs:
1515
onhost_canaries:
16-
matrix:
17-
environment: [ staging, production ]
16+
strategy:
17+
matrix:
18+
environment: [ staging, production ]
1819

1920
uses: ./.github/workflows/component_onhost_canaries.yml
2021
with:

test/k8s-canaries/terraform/production/.terraform.lock.hcl

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/k8s-canaries/terraform/production/alert_nrql_templates/generic_metric_count.tftpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SELECT count(${metric})
22
FROM ${sample}
33
WHERE (
4-
clusterName = '${cluster_name}'
4+
clusterName = '${instance_id}'
55
AND `label.app.kubernetes.io/name` = 'agent-control'
66
%{ for k, v in wheres }
77
AND ${k}='${v}'

test/k8s-canaries/terraform/production/alert_nrql_templates/generic_metric_threshold.tftpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SELECT max(${metric})
22
FROM ${sample}
33
WHERE (
4-
clusterName = '${cluster_name}'
4+
clusterName = '${instance_id}'
55
AND `label.app.kubernetes.io/name` = 'agent-control'
66
%{ for k, v in wheres }
77
AND ${k}='${v}'

test/k8s-canaries/terraform/production/backend.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ terraform {
44
source = "hashicorp/aws"
55
version = ">= 5.48"
66
}
7+
8+
newrelic = {
9+
source = "newrelic/newrelic"
10+
}
711
}
812

913
backend "s3" {
@@ -23,3 +27,9 @@ provider "aws" {
2327
}
2428
}
2529
}
30+
31+
provider "newrelic" {
32+
account_id = var.account_id
33+
api_key = var.api_key
34+
region = "Staging" # To change to US when production is stable
35+
}

test/k8s-canaries/terraform/production/main.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ variable "account_id" {}
1111
variable "api_key" {}
1212
variable "slack_webhook_url" {}
1313
module "alerts" {
14-
source = "../modules/nr_alerts"
14+
source = "../../../terraform/modules/nr_alerts"
1515

1616
api_key = var.api_key
1717
account_id = var.account_id
1818
slack_webhook_url = var.slack_webhook_url
1919
policies_prefix = "Agent Control canaries metric monitoring"
20+
21+
region = "Staging" # To change to US when production is stable
22+
instance_id = "Agent_Control_Canaries_Production-Cluster"
23+
2024
conditions = [
2125
{
2226
name = "CPU usage (cores)"
@@ -74,6 +78,4 @@ module "alerts" {
7478
template_name = "./alert_nrql_templates/generic_metric_count.tftpl"
7579
},
7680
]
77-
region = "Staging" # To change to US when production is stable
78-
cluster_name = "Agent_Control_Canaries_Production-Cluster"
7981
}

test/k8s-canaries/terraform/staging/alert_nrql_templates/generic_metric_count.tftpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SELECT count(${metric})
22
FROM ${sample}
33
WHERE (
4-
clusterName = '${cluster_name}'
4+
clusterName = '${instance_id}'
55
AND `label.app.kubernetes.io/name` = 'agent-control'
66
%{ for k, v in wheres }
77
AND ${k}='${v}'

test/k8s-canaries/terraform/staging/alert_nrql_templates/generic_metric_threshold.tftpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SELECT max(${metric})
22
FROM ${sample}
33
WHERE (
4-
clusterName = '${cluster_name}'
4+
clusterName = '${instance_id}'
55
AND `label.app.kubernetes.io/name` = 'agent-control'
66
%{ for k, v in wheres }
77
AND ${k}='${v}'

0 commit comments

Comments
 (0)