Skip to content

Commit 24bca2c

Browse files
author
daniel
authored
chore: migrate dashboard and data source definition to grafana central (#363)
1 parent 0e2e4c6 commit 24bca2c

File tree

12 files changed

+904
-856
lines changed

12 files changed

+904
-856
lines changed

.github/workflows/ci_terraform.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ jobs:
3434

3535
- name: Init Terraform
3636
id: tf-init
37-
uses: WalletConnect/actions/terraform/init/@1.0.3
37+
uses: WalletConnect/actions/terraform/init/@2.5.4
3838
with:
3939
environment: staging
4040

4141
- name: Check Terraform Formatting
4242
id: tf-fmt
43-
uses: WalletConnect/actions/terraform/check-fmt/@1.0.3
43+
uses: WalletConnect/actions/terraform/check-fmt/@2.5.4
4444

4545
get-version:
4646
if: github.event_name == 'pull_request'
@@ -109,24 +109,24 @@ jobs:
109109

110110
- name: Get Grafana details
111111
id: grafana-get-details
112-
uses: WalletConnect/actions/aws/grafana/get-details/@1.0.3
112+
uses: WalletConnect/actions/aws/grafana/get-details/@2.5.4
113113

114114
- name: Get Grafana key
115115
id: grafana-get-key
116-
uses: WalletConnect/actions/aws/grafana/get-key/@1.0.3
116+
uses: WalletConnect/actions/aws/grafana/get-key/@2.5.4
117117
with:
118118
key-prefix: ${{ github.event.repository.name }}-staging
119119
workspace-id: ${{ steps.grafana-get-details.outputs.workspace-id }}
120120

121121
- name: Init Terraform
122122
id: tf-init
123-
uses: WalletConnect/actions/terraform/init/@1.0.3
123+
uses: WalletConnect/actions/terraform/init/@2.5.4
124124
with:
125125
environment: staging
126126

127127
- name: Run Terraform Plan
128128
id: tf-plan-staging
129-
uses: WalletConnect/actions/terraform/plan/@1.0.3
129+
uses: WalletConnect/actions/terraform/plan/@2.5.4
130130
env:
131131
TF_VAR_grafana_auth: ${{ steps.grafana-get-key.outputs.key }}
132132
TF_VAR_grafana_endpoint: ${{ steps.grafana-get-details.outputs.endpoint }}
@@ -138,7 +138,7 @@ jobs:
138138

139139
- name: Delete Grafana key
140140
id: grafana-delete-key
141-
uses: WalletConnect/actions/aws/grafana/delete-key/@1.0.3
141+
uses: WalletConnect/actions/aws/grafana/delete-key/@2.5.4
142142
if: ${{ success() || failure() || cancelled() }} # don't use always() since it creates non-cancellable jobs
143143
with:
144144
key-name: ${{ steps.grafana-get-key.outputs.key-name }}

terraform/.terraform.lock.hcl

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

terraform/inputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
data "terraform_remote_state" "monitoring" {
3+
backend = "remote"
4+
config = {
5+
organization = "wallet-connect"
6+
workspaces = {
7+
name = "monitoring"
8+
}
9+
}
10+
}

terraform/main.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
locals {
22
app_name = "push"
3-
environment = terraform.workspace
3+
environment = var.environment
44

55
fqdn = local.environment == "prod" ? var.public_url : "${local.environment}.${var.public_url}"
66
backup_fqdn = replace(local.fqdn, ".com", ".org")
@@ -80,7 +80,7 @@ module "database_cluster" {
8080

8181
name = "${local.environment}-${local.app_name}-database"
8282
engine = "aurora-postgresql"
83-
engine_version = "13.12"
83+
engine_version = "13.18"
8484
engine_mode = "provisioned"
8585
instance_class = "db.serverless"
8686
instances = {
@@ -114,7 +114,7 @@ module "tenant_database_cluster" {
114114

115115
name = "${local.environment}-${local.app_name}-tenant-database"
116116
engine = "aurora-postgresql"
117-
engine_version = "13.12"
117+
engine_version = "13.18"
118118
engine_mode = "provisioned"
119119
instance_class = "db.serverless"
120120
instances = {
@@ -192,6 +192,9 @@ module "monitoring" {
192192
load_balancer_arn = module.ecs.load_balancer_arn
193193
environment = local.environment
194194
notification_channels = var.notification_channels
195+
196+
region = var.region
197+
monitoring_role_arn = data.terraform_remote_state.monitoring.outputs.grafana_workspaces.central.iam_role_arn
195198
}
196199

197200
data "aws_ecr_repository" "repository" {

terraform/monitoring/context.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module "this" {
2+
source = "app.terraform.io/wallet-connect/label/null"
3+
version = "0.3.2"
4+
5+
region = var.region
6+
name = var.app_name
7+
}
Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,54 @@
1-
local grafana = import 'grafonnet-lib/grafana.libsonnet';
2-
local panels = import 'panels/panels.libsonnet';
1+
local grafana = import 'grafonnet-lib/grafana.libsonnet';
2+
local panels = import 'panels/panels.libsonnet';
33

4-
local dashboard = grafana.dashboard;
5-
local row = grafana.row;
6-
local annotation = grafana.annotation;
7-
local layout = grafana.layout;
4+
local dashboard = grafana.dashboard;
5+
local row = grafana.row;
6+
local annotation = grafana.annotation;
7+
local layout = grafana.layout;
88

9-
local ds = {
9+
local ds = {
1010
prometheus: {
1111
type: 'prometheus',
12-
uid: std.extVar('prometheus_uid'),
12+
uid: std.extVar('prometheus_uid'),
1313
},
1414
cloudwatch: {
1515
type: 'cloudwatch',
16-
uid: std.extVar('cloudwatch_uid'),
16+
uid: std.extVar('cloudwatch_uid'),
1717
},
1818
};
19-
local vars = {
20-
namespace: 'Push',
21-
environment: std.extVar('environment'),
22-
notifications: std.parseJson(std.extVar('notifications')),
19+
local vars = {
20+
namespace: 'Push',
21+
environment: std.extVar('environment'),
22+
notifications: std.parseJson(std.extVar('notifications')),
2323
};
2424

2525
////////////////////////////////////////////////////////////////////////////////
2626

27-
local height = 8;
28-
local pos = grafana.layout.pos(height);
27+
local height = 8;
28+
local pos = grafana.layout.pos(height);
2929

3030
////////////////////////////////////////////////////////////////////////////////
3131

3232
dashboard.new(
33-
title = std.extVar('dashboard_title'),
34-
uid = std.extVar('dashboard_uid'),
35-
editable = true,
36-
graphTooltip = dashboard.graphTooltips.sharedCrosshair,
37-
timezone = dashboard.timezones.utc,
33+
title=std.extVar('dashboard_title'),
34+
uid=std.extVar('dashboard_uid'),
35+
editable=true,
36+
graphTooltip=dashboard.graphTooltips.sharedCrosshair,
37+
timezone=dashboard.timezones.utc,
3838
)
3939
.addAnnotation(
4040
annotation.new(
41-
target = {
42-
limit: 100,
41+
target={
42+
limit: 100,
4343
matchAny: false,
44-
tags: [],
45-
type: 'dashboard',
44+
tags: [],
45+
type: 'dashboard',
4646
},
4747
)
4848
)
49-
5049
.addPanels(layout.generate_grid([
5150
//////////////////////////////////////////////////////////////////////////////
5251
row.new('Application'),
53-
panels.app.postgres_query_rate(ds, vars) { gridPos: pos._6 },
54-
panels.app.postgres_query_latency(ds, vars) { gridPos: pos._6 },
52+
panels.app.postgres_query_rate(ds, vars) { gridPos: pos._6 },
53+
panels.app.postgres_query_latency(ds, vars) { gridPos: pos._6 },
5554
]))

0 commit comments

Comments
 (0)