From 53f8f77153fd3573619ac0383f7a1ae99a26be16 Mon Sep 17 00:00:00 2001 From: Yuchen Ying Date: Wed, 9 Sep 2020 15:47:57 -0700 Subject: [PATCH] Convert JSON to YAML. Writing multiline queries is easier in YAML than in JSON. --- terraform/alerting/dashboards/e2e.json | 43 ------------------- terraform/alerting/dashboards/e2e.yaml | 38 ++++++++++++++++ .../dashboards/verification-server.json | 43 ------------------- .../dashboards/verification-server.yaml | 38 ++++++++++++++++ terraform/alerting/monitoring.tf | 4 +- 5 files changed, 78 insertions(+), 88 deletions(-) delete mode 100644 terraform/alerting/dashboards/e2e.json create mode 100644 terraform/alerting/dashboards/e2e.yaml delete mode 100644 terraform/alerting/dashboards/verification-server.json create mode 100644 terraform/alerting/dashboards/verification-server.yaml diff --git a/terraform/alerting/dashboards/e2e.json b/terraform/alerting/dashboards/e2e.json deleted file mode 100644 index 698a74000..000000000 --- a/terraform/alerting/dashboards/e2e.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "displayName": "e2e", - "gridLayout": { - "columns": "2", - "widgets": [{ - "title": "/api/issue/code_issued_count rate by job", - "xyChart": { - "chartOptions": { - "mode": "COLOR" - }, - "dataSets": [{ - "plotType": "LINE", - "timeSeriesQuery": { - "timeSeriesQueryLanguage": "generic_task :: custom.googleapis.com/opencensus/en-verification-server/api/issue/codes_issued_count | align rate() | every 1m | [resource.job]" - } - }], - "timeshiftDuration": "0s", - "yAxis": { - "label": "y1Axis", - "scale": "LINEAR" - } - } - }, { - "title": "/api/verify/attempt_count rate by job", - "xyChart": { - "chartOptions": { - "mode": "COLOR" - }, - "dataSets": [{ - "plotType": "LINE", - "timeSeriesQuery": { - "timeSeriesQueryLanguage": "generic_task :: custom.googleapis.com/opencensus/en-verification-server/api/verify/attempt_count | align rate() | every 1m | [resource.job]" - } - }], - "timeshiftDuration": "0s", - "yAxis": { - "label": "y1Axis", - "scale": "LINEAR" - } - } - }] - } -} \ No newline at end of file diff --git a/terraform/alerting/dashboards/e2e.yaml b/terraform/alerting/dashboards/e2e.yaml new file mode 100644 index 000000000..fd6ffd184 --- /dev/null +++ b/terraform/alerting/dashboards/e2e.yaml @@ -0,0 +1,38 @@ +displayName: e2e +gridLayout: + columns: 2 + widgets: + - title: /api/issue/code_issued_count rate by job + xyChart: + chartOptions: + mode: COLOR + dataSets: + - plotType: LINE + timeSeriesQuery: + timeSeriesQueryLanguage: > + generic_task :: + custom.googleapis.com/opencensus/en-verification-server/api/issue/codes_issued_count + | align rate() + | every 1m + | [resource.job] + timeshiftDuration: 0s + yAxis: + label: y1Axis + scale: LINEAR + - title: /api/verify/attempt_count rate by job + xyChart: + chartOptions: + mode: COLOR + dataSets: + - plotType: LINE + timeSeriesQuery: + timeSeriesQueryLanguage: > + generic_task :: + custom.googleapis.com/opencensus/en-verification-server/api/verify/attempt_count + | align rate() + | every 1m + | [resource.job] + timeshiftDuration: 0s + yAxis: + label: "y1Axis" + scale: "LINEAR" diff --git a/terraform/alerting/dashboards/verification-server.json b/terraform/alerting/dashboards/verification-server.json deleted file mode 100644 index c20af4829..000000000 --- a/terraform/alerting/dashboards/verification-server.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "displayName": "Verification Server", - "gridLayout": { - "columns": "2", - "widgets": [{ - "title": "Cloud Run Revision - Request Count (grouped) [SUM]", - "xyChart": { - "chartOptions": { - "mode": "COLOR" - }, - "dataSets": [{ - "plotType": "LINE", - "timeSeriesQuery": { - "timeSeriesQueryLanguage": "cloud_run_revision :: run.googleapis.com/request_count | align rate() | every 1m | [resource.service_name, metric.response_code_class]" - } - }], - "timeshiftDuration": "0s", - "yAxis": { - "label": "y1Axis", - "scale": "LINEAR" - } - } - }, { - "title": "OpenCensus/en-verification-server/api/issue/attempt_count by label.job [SUM]", - "xyChart": { - "chartOptions": { - "mode": "COLOR" - }, - "dataSets": [{ - "plotType": "LINE", - "timeSeriesQuery": { - "timeSeriesQueryLanguage": "generic_task :: custom.googleapis.com/opencensus/en-verification-server/api/issue/attempt_count | align rate() | every 1m | [resource.job]" - } - }], - "timeshiftDuration": "0s", - "yAxis": { - "label": "y1Axis", - "scale": "LINEAR" - } - } - }] - } -} \ No newline at end of file diff --git a/terraform/alerting/dashboards/verification-server.yaml b/terraform/alerting/dashboards/verification-server.yaml new file mode 100644 index 000000000..1db658daf --- /dev/null +++ b/terraform/alerting/dashboards/verification-server.yaml @@ -0,0 +1,38 @@ +displayName: Verification Server +gridLayout: + columns: 2 + widgets: + - title: Cloud Run Revision - Request Count (grouped) [SUM] + xyChart: + chartOptions: + mode: COLOR + dataSets: + - plotType: LINE + timeSeriesQuery: + timeSeriesQueryLanguage: > + cloud_run_revision :: + run.googleapis.com/request_count + | align rate() + | every 1m + | [resource.service_name, metric.response_code_class] + timeshiftDuration: 0s + yAxis: + label: y1Axis + scale: LINEAR + - title: OpenCensus/en-verification-server/api/issue/attempt_count by label.job [SUM] + xyChart: + chartOptions: + mode: COLOR + dataSets: + - plotType: LINE + timeSeriesQuery: + timeSeriesQueryLanguage: > + generic_task :: + custom.googleapis.com/opencensus/en-verification-server/api/issue/attempt_count + | align rate() + | every 1m + | [resource.job] + timeshiftDuration: 0s + yAxis: + label: y1Axis + scale: LINEAR diff --git a/terraform/alerting/monitoring.tf b/terraform/alerting/monitoring.tf index f62caa50a..287f666a8 100644 --- a/terraform/alerting/monitoring.tf +++ b/terraform/alerting/monitoring.tf @@ -14,7 +14,7 @@ resource "google_monitoring_dashboard" "verification-server" { project = var.project - dashboard_json = file("${path.module}/dashboards/verification-server.json") + dashboard_json = jsonencode(yamldecode(file("${path.module}/dashboards/verification-server.yaml"))) depends_on = [ null_resource.manual-step-to-enable-workspace ] @@ -22,7 +22,7 @@ resource "google_monitoring_dashboard" "verification-server" { resource "google_monitoring_dashboard" "e2e" { project = var.project - dashboard_json = file("${path.module}/dashboards/e2e.json") + dashboard_json = jsonencode(yamldecode(file("${path.module}/dashboards/e2e.yaml"))) depends_on = [ null_resource.manual-step-to-enable-workspace ]