From f505b477a455e3d6eba0518c8759dfa091e5cd7c Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sun, 31 Jan 2021 21:10:01 +0700 Subject: [PATCH 01/77] Update NewRelic to v2.16.0 --- .terraform.lock.hcl | 24 ++++++++++++++++++++ main.tf | 55 +++++++++++++++++++++++++++++++-------------- variables.tf | 4 ++++ versions.tf | 2 +- 4 files changed, 67 insertions(+), 18 deletions(-) create mode 100644 .terraform.lock.hcl diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl new file mode 100644 index 0000000..88398d1 --- /dev/null +++ b/.terraform.lock.hcl @@ -0,0 +1,24 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/newrelic/newrelic" { + version = "2.16.0" + constraints = "~> 2.16.0" + hashes = [ + "h1:WPznJOT/1b74dhNuwXiehrD461wwu0phgtMi+BL5nzw=", + "zh:12175bf063796338579e46d513c0a305c2343e8f84abd768dcb4af4cfb03a810", + "zh:131eda225bd177eff9069a5789faee7ddffdb8a159706872bd54af6a16e4e43c", + "zh:273fa70efde94398031d4c27b727e3d6e4fd986e76ba8caced8769132fb5887d", + "zh:2af9276d3d4e1e8ae464e0a255a2b9908a76b70e75257fb562f17db3fcba0c2a", + "zh:470bfe4ef82df0e9e7fc351eaa585526f495f37a6e5f81fb44ef51feac97b7c1", + "zh:4736224dc6923692b6be42e2b53342fd7cbd2bedf66a64b6b72ad952f74a8d7e", + "zh:6fc749ec66ef15d161081ada0cb567bf415adde1295aed545d6297d4825acebd", + "zh:8cff29805de6f9ced4e9f0275cfabc4e341a70fcb339e9c0f536521e6d081651", + "zh:9562ead071ae72347186028fc662e8b08dc6f6537954469ad1f363c17b594229", + "zh:ae625ec4ea48c1f5fea6f7cddf6c8897ab9250b301d6ff906cb3d92865c42079", + "zh:c5756e85519d162ec353fb41bbc1b279db8010f2a33e8e0afc98454fdfe88153", + "zh:c6e132d0fa8a5625120d6266dcb8e431eb1570419b94047cd073580159916685", + "zh:cd1828018106b9092113d93782930a105dbe78ff0d82b1db952b54546e3494bc", + "zh:f473b6a44edb5bb8b012606197cb59d853ec289eb1e38aa9812f4c8b4293d2d4", + ] +} diff --git a/main.tf b/main.tf index bff084f..65c8f08 100644 --- a/main.tf +++ b/main.tf @@ -1,22 +1,43 @@ -resource "newrelic_dashboard" "main" { - title = var.dashboard_name +resource "newrelic_one_dashboard" "main" { + name = var.dashboard_name + + page { + name = "New Relic Terraform Example" + + widget_billboard { + title = "Requests per minute" + row = 1 + column = 1 - filter { - event_types = [ - "Transaction" - ] - attributes = [ - "appName", - "name", - "metric_status", - "method", - "ops", - "code", - "err", - "err_line", - "message", - ] + nrql_query { + account_id = var.account_id + query = "FROM Transaction SELECT rate(count(*), 1 minute)" + } + } + + widget_bar { + title = "Average transaction duration, by application" + row = 1 + column = 5 + + nrql_query { + account_id = var.account_id + query = "FROM Transaction SELECT average(duration) FACET appName" + } + } + + widget_markdown { + title = "Dashboard Note" + row = 1 + column = 9 + + text = "### Helpful Links\n\n* [New Relic One](https://one.newrelic.com)\n* [Developer Portal](https://developer.newrelic.com)" + } } +} + +resource "newrelic_dashboard" "main" { + title = var.dashboard_name ##################### # Standard widgets. diff --git a/variables.tf b/variables.tf index 85b785b..5657797 100644 --- a/variables.tf +++ b/variables.tf @@ -10,6 +10,10 @@ variable "application_id" { type = number } +variable "account_id" { + type = number +} + variable "event_name" { type = string } diff --git a/versions.tf b/versions.tf index 006ed90..3682606 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { newrelic = { source = "newrelic/newrelic" - version = "~> 2.15.1" + version = "~> 2.16.0" } } } \ No newline at end of file From add5b321a2deadf1160c21e98a0ea748b768dd25 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sun, 31 Jan 2021 22:14:34 +0700 Subject: [PATCH 02/77] Use One Dashboard --- .gitignore | 3 + main.tf | 403 ++++++++++++++++++++++++++++----------------------- variables.tf | 2 +- 3 files changed, 224 insertions(+), 184 deletions(-) diff --git a/.gitignore b/.gitignore index 95ffc73..064fef3 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ override.tf.json # IDE .idea/ + +# Development +development/ diff --git a/main.tf b/main.tf index 65c8f08..f285014 100644 --- a/main.tf +++ b/main.tf @@ -2,7 +2,29 @@ resource "newrelic_one_dashboard" "main" { name = var.dashboard_name page { - name = "New Relic Terraform Example" + name = "Overview" + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget.value + row = var.base_row + floor(widget.key / 3) + column = widget.key % 3 + + warning = 95 + critical = 75 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget.value}'" + } + } + } + } + + page { + name = "Summary" widget_billboard { title = "Requests per minute" @@ -11,224 +33,239 @@ resource "newrelic_one_dashboard" "main" { nrql_query { account_id = var.account_id - query = "FROM Transaction SELECT rate(count(*), 1 minute)" + query = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName = '${var.service_name}'" } } - widget_bar { - title = "Average transaction duration, by application" + widget_table { + title = "Requests per minute, by transaction" row = 1 - column = 5 + column = 2 nrql_query { account_id = var.account_id - query = "FROM Transaction SELECT average(duration) FACET appName" + query = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName = '${var.service_name}' FACET name" } } - widget_markdown { - title = "Dashboard Note" - row = 1 - column = 9 - - text = "### Helpful Links\n\n* [New Relic One](https://one.newrelic.com)\n* [Developer Portal](https://developer.newrelic.com)" - } - } -} - -resource "newrelic_dashboard" "main" { - title = var.dashboard_name - - ##################### - # Standard widgets. - ##################### - - widget { - title = "Requests per minute" - visualization = "billboard" - nrql = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName ='${var.service_name}'" - row = 1 - column = 1 - } - - widget { - title = "Requests per minute, by transaction" - visualization = "facet_table" - nrql = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName ='${var.service_name}' FACET name" - row = 1 - column = 2 - width = 2 - } - - widget { - title = "Metric status percentage" - visualization = "facet_pie_chart" - nrql = "SELECT count(*) FROM ${var.event_name} FACET `metric_status` LIMIT 10 EXTRAPOLATE" - row = 2 - column = 1 - } - - widget { - title = "Metric status histogram" - visualization = "faceted_line_chart" - nrql = "SELECT count(*) FROM ${var.event_name} FACET `metric_status` LIMIT 10 EXTRAPOLATE TIMESERIES" - row = 2 - column = 2 - } - - widget { - title = "Method with most errors" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `method` LIMIT 10 EXTRAPOLATE" - row = 2 - column = 3 - } - - widget { - title = "Error with most occurrence" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `err` LIMIT 10 EXTRAPOLATE" - row = 3 - column = 1 - } - - widget { - title = "Error code with most occurrence" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `code` LIMIT 10 EXTRAPOLATE" - row = 3 - column = 2 - } - - widget { - title = "Human error message with most occurrence" - visualization = "facet_table" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `message` LIMIT 10 EXTRAPOLATE" - row = 3 - column = 3 - } + widget_billboard { + title = "Success rate" + row = 2 + column = 1 - widget { - title = "Operation with most errors" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `ops` LIMIT 10 EXTRAPOLATE" - row = 4 - column = 1 - } + warning = 95 + critical = 75 - widget { - title = "Line with most errors" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `err_line` LIMIT 10 EXTRAPOLATE" - row = 4 - column = 2 - width = 2 - } + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Success Rate' from ${var.event_name}" + } + } - ##################### - # Event widgets. - ##################### + widget_pie { + title = "Metric status percentage" + row = 2 + column = 2 - # First rows. + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} FACET `metric_status` LIMIT 10 EXTRAPOLATE" + } + } - dynamic "widget" { - for_each = var.event_methods + widget_line { + title = "Metric status histogram" + row = 2 + column = 3 - content { - title = "${widget.value} request per minute" - visualization = "billboard" - nrql = "SELECT rate(count(*), 1 minute) FROM ${var.event_name} WHERE method = '${widget.value}'" - row = var.base_row + widget.key * (var.total_column_per_method / 3) - column = 1 + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} FACET `metric_status` LIMIT 10 EXTRAPOLATE TIMESERIES" + } } - } - dynamic "widget" { - for_each = var.event_methods + widget_table { + title = "Method with most errors" + row = 3 + column = 1 + width = 6 - content { - title = "${widget.value} metric status percentage" - visualization = "facet_pie_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE method = '${widget.value}' FACET `metric_status` LIMIT 10 EXTRAPOLATE" - row = var.base_row + widget.key * (var.total_column_per_method / 3) - column = 2 + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `method` LIMIT 10 EXTRAPOLATE" + } } - } - dynamic "widget" { - for_each = var.event_methods + widget_table { + title = "Human error message with most occurrence" + row = 3 + column = 2 + width = 6 - content { - title = "${widget.value} metric status histogram" - visualization = "faceted_line_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE method = '${widget.value}' FACET `metric_status` LIMIT 10 EXTRAPOLATE TIMESERIES" - row = var.base_row + widget.key * (var.total_column_per_method / 3) - column = 3 + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `message` LIMIT 10 EXTRAPOLATE" + } } - } - # Second rows. - - dynamic "widget" { - for_each = var.event_methods + widget_bar { + title = "Error with most occurrence" + row = 4 + column = 1 - content { - title = "${widget.value} error with most occurrence" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `err` LIMIT 10 EXTRAPOLATE" - row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) - column = 1 + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `err` LIMIT 10 EXTRAPOLATE" + } } - } - dynamic "widget" { - for_each = var.event_methods + widget_bar { + title = "Error code with most occurrence" + row = 4 + column = 2 - content { - title = "${widget.value} error code with most occurrence" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `code` LIMIT 10 EXTRAPOLATE" - row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) - column = 2 + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `code` LIMIT 10 EXTRAPOLATE" + } } - } - dynamic "widget" { - for_each = var.event_methods + widget_bar { + title = "Operation with most errors" + row = 4 + column = 3 - content { - title = "${widget.value} human error message with most occurrence" - visualization = "facet_table" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `message` LIMIT 10 EXTRAPOLATE" - row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) - column = 3 + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `ops` LIMIT 10 EXTRAPOLATE" + } } - } - - # Third rows. - dynamic "widget" { - for_each = var.event_methods + widget_table { + title = "Line with most errors" + row = 5 + column = 1 + width = 12 - content { - title = "${widget.value} operation with most errors" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `ops` LIMIT 10 EXTRAPOLATE" - row = 2 + var.base_row + widget.key * (var.total_column_per_method / 3) - column = 1 + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `err_line` LIMIT 10 EXTRAPOLATE" + } } } - dynamic "widget" { - for_each = var.event_methods - - content { - title = "${widget.value} line with most errors" - visualization = "facet_bar_chart" - nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `err_line` LIMIT 10 EXTRAPOLATE" - row = 2 + var.base_row + widget.key * (var.total_column_per_method / 3) - column = 2 - width = 2 - } + page { + name = "Detail" } } + +#resource "newrelic_dashboard" "main" { +# title = var.dashboard_name +# +# ##################### +# # Event widgets. +# ##################### +# +# # First rows. +# +# dynamic "widget" { +# for_each = var.event_methods +# +# content { +# title = "${widget.value} request per minute" +# visualization = "billboard" +# nrql = "SELECT rate(count(*), 1 minute) FROM ${var.event_name} WHERE method = '${widget.value}'" +# row = var.base_row + widget.key * (var.total_column_per_method / 3) +# column = 1 +# } +# } +# +# dynamic "widget" { +# for_each = var.event_methods +# +# content { +# title = "${widget.value} metric status percentage" +# visualization = "facet_pie_chart" +# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method = '${widget.value}' FACET `metric_status` LIMIT 10 EXTRAPOLATE" +# row = var.base_row + widget.key * (var.total_column_per_method / 3) +# column = 2 +# } +# } +# +# dynamic "widget" { +# for_each = var.event_methods +# +# content { +# title = "${widget.value} metric status histogram" +# visualization = "faceted_line_chart" +# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method = '${widget.value}' FACET `metric_status` LIMIT 10 EXTRAPOLATE TIMESERIES" +# row = var.base_row + widget.key * (var.total_column_per_method / 3) +# column = 3 +# } +# } +# +# # Second rows. +# +# dynamic "widget" { +# for_each = var.event_methods +# +# content { +# title = "${widget.value} error with most occurrence" +# visualization = "facet_bar_chart" +# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `err` LIMIT 10 EXTRAPOLATE" +# row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) +# column = 1 +# } +# } +# +# dynamic "widget" { +# for_each = var.event_methods +# +# content { +# title = "${widget.value} error code with most occurrence" +# visualization = "facet_bar_chart" +# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `code` LIMIT 10 EXTRAPOLATE" +# row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) +# column = 2 +# } +# } +# +# dynamic "widget" { +# for_each = var.event_methods +# +# content { +# title = "${widget.value} human error message with most occurrence" +# visualization = "facet_table" +# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `message` LIMIT 10 EXTRAPOLATE" +# row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) +# column = 3 +# } +# } +# +# # Third rows. +# +# dynamic "widget" { +# for_each = var.event_methods +# +# content { +# title = "${widget.value} operation with most errors" +# visualization = "facet_bar_chart" +# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `ops` LIMIT 10 EXTRAPOLATE" +# row = 2 + var.base_row + widget.key * (var.total_column_per_method / 3) +# column = 1 +# } +# } +# +# dynamic "widget" { +# for_each = var.event_methods +# +# content { +# title = "${widget.value} line with most errors" +# visualization = "facet_bar_chart" +# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `err_line` LIMIT 10 EXTRAPOLATE" +# row = 2 + var.base_row + widget.key * (var.total_column_per_method / 3) +# column = 2 +# width = 2 +# } +# } +#} diff --git a/variables.tf b/variables.tf index 5657797..cbebb51 100644 --- a/variables.tf +++ b/variables.tf @@ -24,7 +24,7 @@ variable "event_methods" { variable "base_row" { type = number - default = 5 + default = 1 } variable "total_column_per_method" { From 66f0cf67bd9c4c2a58b430be4d495a84e5b8645d Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sun, 31 Jan 2021 22:42:47 +0700 Subject: [PATCH 03/77] Comment Out Output --- outputs.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/outputs.tf b/outputs.tf index ba025e4..01f052b 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,4 +1,4 @@ -output "dashboard_url" { - value = newrelic_dashboard.main.dashboard_url - description = "The created dashboard url" -} +#output "dashboard_url" { +# value = newrelic_dashboard.main.dashboard_url +# description = "The created dashboard url" +#} From bedf9e92bb63c5a9c687757ddd891b2ffa237499 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sun, 31 Jan 2021 22:44:41 +0700 Subject: [PATCH 04/77] Fix Widget --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index f285014..329155d 100644 --- a/main.tf +++ b/main.tf @@ -8,16 +8,16 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = widget.value - row = var.base_row + floor(widget.key / 3) - column = widget.key % 3 + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = widget_billboard.key % 3 warning = 95 critical = 75 nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget.value}'" + query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } From 81d8cc9c85c6d2f8bdef055ad00ca0596468dbf6 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sun, 31 Jan 2021 22:51:04 +0700 Subject: [PATCH 05/77] Comment Out Detail --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 329155d..47dfad6 100644 --- a/main.tf +++ b/main.tf @@ -154,9 +154,9 @@ resource "newrelic_one_dashboard" "main" { } } - page { - name = "Detail" - } + # page { + # name = "Detail" + # } } #resource "newrelic_dashboard" "main" { From e76693f349c1bdac204844aadbe6ecc731c3db69 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sun, 31 Jan 2021 22:59:59 +0700 Subject: [PATCH 06/77] Fix Column --- main.tf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.tf b/main.tf index 47dfad6..1b195a8 100644 --- a/main.tf +++ b/main.tf @@ -10,7 +10,7 @@ resource "newrelic_one_dashboard" "main" { content { title = widget_billboard.value row = var.base_row + floor(widget_billboard.key / 3) - column = widget_billboard.key % 3 + column = 1 + (((widget_billboard.key - 1) % 3) * 4) warning = 95 critical = 75 @@ -40,7 +40,7 @@ resource "newrelic_one_dashboard" "main" { widget_table { title = "Requests per minute, by transaction" row = 1 - column = 2 + column = 5 nrql_query { account_id = var.account_id @@ -51,7 +51,7 @@ resource "newrelic_one_dashboard" "main" { widget_billboard { title = "Success rate" row = 2 - column = 1 + column = 9 warning = 95 critical = 75 @@ -65,7 +65,7 @@ resource "newrelic_one_dashboard" "main" { widget_pie { title = "Metric status percentage" row = 2 - column = 2 + column = 5 nrql_query { account_id = var.account_id @@ -76,7 +76,7 @@ resource "newrelic_one_dashboard" "main" { widget_line { title = "Metric status histogram" row = 2 - column = 3 + column = 9 nrql_query { account_id = var.account_id @@ -99,7 +99,7 @@ resource "newrelic_one_dashboard" "main" { widget_table { title = "Human error message with most occurrence" row = 3 - column = 2 + column = 7 width = 6 nrql_query { @@ -122,7 +122,7 @@ resource "newrelic_one_dashboard" "main" { widget_bar { title = "Error code with most occurrence" row = 4 - column = 2 + column = 5 nrql_query { account_id = var.account_id @@ -133,7 +133,7 @@ resource "newrelic_one_dashboard" "main" { widget_bar { title = "Operation with most errors" row = 4 - column = 3 + column = 9 nrql_query { account_id = var.account_id From e1d654c5aff6a13c2ea34b171d8d85bfec41554b Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Mon, 1 Feb 2021 08:09:48 +0700 Subject: [PATCH 07/77] Fix Math --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 1b195a8..a3f1079 100644 --- a/main.tf +++ b/main.tf @@ -10,7 +10,7 @@ resource "newrelic_one_dashboard" "main" { content { title = widget_billboard.value row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + (((widget_billboard.key - 1) % 3) * 4) + column = 1 + (((widget_billboard.key % 3) - 1) * 4) warning = 95 critical = 75 From 00f7fe00c8f216fe676f862ea19aaad722597e93 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Tue, 2 Feb 2021 05:50:44 +0700 Subject: [PATCH 08/77] Fix Summary --- main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index a3f1079..3dc6145 100644 --- a/main.tf +++ b/main.tf @@ -41,6 +41,7 @@ resource "newrelic_one_dashboard" "main" { title = "Requests per minute, by transaction" row = 1 column = 5 + width = 8 nrql_query { account_id = var.account_id @@ -51,7 +52,7 @@ resource "newrelic_one_dashboard" "main" { widget_billboard { title = "Success rate" row = 2 - column = 9 + column = 1 warning = 95 critical = 75 From 6f5501bc0ce4275cd4c45d93fd3e752a36ea6baa Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Tue, 2 Feb 2021 05:52:31 +0700 Subject: [PATCH 09/77] Fix Width --- main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/main.tf b/main.tf index 3dc6145..b18c034 100644 --- a/main.tf +++ b/main.tf @@ -11,6 +11,7 @@ resource "newrelic_one_dashboard" "main" { title = widget_billboard.value row = var.base_row + floor(widget_billboard.key / 3) column = 1 + (((widget_billboard.key % 3) - 1) * 4) + width = 4 warning = 95 critical = 75 From 1ba7ec59fdfcdf7be2b747344eba0f4e36c91396 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Tue, 2 Feb 2021 05:55:06 +0700 Subject: [PATCH 10/77] Debug Column --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index b18c034..6b9063f 100644 --- a/main.tf +++ b/main.tf @@ -8,7 +8,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = widget_billboard.value + title = "${widget_billboard.value} - ${1 + (((widget_billboard.key % 3) - 1) * 4)}" row = var.base_row + floor(widget_billboard.key / 3) column = 1 + (((widget_billboard.key % 3) - 1) * 4) width = 4 From 018bb984178f269403bdd267baba4c2e301dbf35 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Tue, 2 Feb 2021 05:59:32 +0700 Subject: [PATCH 11/77] Fix Overview --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 6b9063f..8af3c44 100644 --- a/main.tf +++ b/main.tf @@ -10,7 +10,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${widget_billboard.value} - ${1 + (((widget_billboard.key % 3) - 1) * 4)}" row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + (((widget_billboard.key % 3) - 1) * 4) + column = 1 + ((widget_billboard.key % 3) * 4) width = 4 warning = 95 From a1faaf22639395289f2ce42d570bdecb81e2db18 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Tue, 2 Feb 2021 06:01:35 +0700 Subject: [PATCH 12/77] Remove Debug --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 8af3c44..66fa231 100644 --- a/main.tf +++ b/main.tf @@ -8,7 +8,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = "${widget_billboard.value} - ${1 + (((widget_billboard.key % 3) - 1) * 4)}" + title = widget_billboard.value row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 4 From 7419b49b3a90baf51efb6525b88cd2a8b851e306 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 11:23:59 +0700 Subject: [PATCH 13/77] Add Overview With Expected Error --- .terraform.lock.hcl | 34 +++++++++++++++++----------------- main.tf | 23 +++++++++++++++++++++++ outputs.tf | 8 ++++---- versions.tf | 2 +- 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index 88398d1..1c26b47 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -2,23 +2,23 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/newrelic/newrelic" { - version = "2.16.0" - constraints = "~> 2.16.0" + version = "2.18.0" + constraints = "~> 2.18.0" hashes = [ - "h1:WPznJOT/1b74dhNuwXiehrD461wwu0phgtMi+BL5nzw=", - "zh:12175bf063796338579e46d513c0a305c2343e8f84abd768dcb4af4cfb03a810", - "zh:131eda225bd177eff9069a5789faee7ddffdb8a159706872bd54af6a16e4e43c", - "zh:273fa70efde94398031d4c27b727e3d6e4fd986e76ba8caced8769132fb5887d", - "zh:2af9276d3d4e1e8ae464e0a255a2b9908a76b70e75257fb562f17db3fcba0c2a", - "zh:470bfe4ef82df0e9e7fc351eaa585526f495f37a6e5f81fb44ef51feac97b7c1", - "zh:4736224dc6923692b6be42e2b53342fd7cbd2bedf66a64b6b72ad952f74a8d7e", - "zh:6fc749ec66ef15d161081ada0cb567bf415adde1295aed545d6297d4825acebd", - "zh:8cff29805de6f9ced4e9f0275cfabc4e341a70fcb339e9c0f536521e6d081651", - "zh:9562ead071ae72347186028fc662e8b08dc6f6537954469ad1f363c17b594229", - "zh:ae625ec4ea48c1f5fea6f7cddf6c8897ab9250b301d6ff906cb3d92865c42079", - "zh:c5756e85519d162ec353fb41bbc1b279db8010f2a33e8e0afc98454fdfe88153", - "zh:c6e132d0fa8a5625120d6266dcb8e431eb1570419b94047cd073580159916685", - "zh:cd1828018106b9092113d93782930a105dbe78ff0d82b1db952b54546e3494bc", - "zh:f473b6a44edb5bb8b012606197cb59d853ec289eb1e38aa9812f4c8b4293d2d4", + "h1:+WtcDO3S28455QdnakM0EsbSO9uO9FpvC6pPXvlOsD4=", + "zh:08805968cb924655c8b27e64dddb462c977dc8646fc9f4b77904ec34c6a29cc6", + "zh:285dd29eacf069dddf4d3628ae00e209f9d1131bd671d3a9fcfac1dc33df427b", + "zh:359a9501ed7b1df3a94d12ea07b79b5f550329dbdc4f9ea5e7d507bdd97979a9", + "zh:4847da1d793cb6a616b804305227b390bafa87e88171918849969777595d6e1c", + "zh:51cb14f62fd4caa5c735297584814a9b680bd39006eaac59c7d367af1c1eb516", + "zh:5db6a859ad3ec7faaa81e94ca0545741ff8e6fcbbc569e0a50e61f250fd200cf", + "zh:69b0194b31a5f62af870b90d870b1ca4f9625af3a06a9d876adf6419c6cdd8e7", + "zh:706d885aebd1e809ffb6298254667a7bdd5e53394764a62b720f8f77950abd50", + "zh:ade5bf4f3396af578a97f1ec3c6c5b509829568fa21ba19b2c6eba8484370ee1", + "zh:c672d6b28f5c1754d2d798ba8ce8759a06c7941583338df0510afee095def222", + "zh:da30768c39b8841b120d499b122f902638db7b8baae7102cd0c1fc9220fc2111", + "zh:e9c572d26ffe54b0bf323a7ea17361923e6597f6736e51d8c68e4b92e841f788", + "zh:f09481275e2ec27b70b4f782f49249c81358149870111b26f0800cde2751c46c", + "zh:fb52113fa30d1d06c56838663cf87cb6f9be4aafe706c5dedc809480f6d25eff", ] } diff --git a/main.tf b/main.tf index 66fa231..1cc1178 100644 --- a/main.tf +++ b/main.tf @@ -4,6 +4,29 @@ resource "newrelic_one_dashboard" "main" { page { name = "Overview" + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 4 + + warning = 95 + critical = 75 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + } + + page { + name = "Overview With Expected Error" + dynamic "widget_billboard" { for_each = var.event_methods diff --git a/outputs.tf b/outputs.tf index 01f052b..d69e187 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,4 +1,4 @@ -#output "dashboard_url" { -# value = newrelic_dashboard.main.dashboard_url -# description = "The created dashboard url" -#} +output "dashboard_url" { + value = newrelic_one_dashboard.main.permalink + description = "The created dashboard url" +} diff --git a/versions.tf b/versions.tf index 3682606..65c22fd 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { newrelic = { source = "newrelic/newrelic" - version = "~> 2.16.0" + version = "~> 2.18.0" } } } \ No newline at end of file From ee7d88a555bda8d45ca2940a691718d045f28d63 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 11:43:31 +0700 Subject: [PATCH 14/77] Better Rate Calculation --- main.tf | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/main.tf b/main.tf index 1cc1178..92b6c86 100644 --- a/main.tf +++ b/main.tf @@ -2,7 +2,8 @@ resource "newrelic_one_dashboard" "main" { name = var.dashboard_name page { - name = "Overview" + name = "Success Rate" + description = "Rate => metric_status = success + expected_error" dynamic "widget_billboard" { for_each = var.event_methods @@ -18,14 +19,15 @@ resource "newrelic_one_dashboard" "main" { nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } } page { - name = "Overview With Expected Error" + name = "Error Rate" + description = "Rate => metric_status = error" dynamic "widget_billboard" { for_each = var.event_methods @@ -36,12 +38,36 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 95 - critical = 75 + warning = 5 + critical = 25 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + } + + page { + name = "Real Error Rate" + description = "Rate => metric_status = error + expected_error" + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 4 + + warning = 10 + critical = 25 nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } From 9f75647a08ff9098cdc3ee032cc8d9e4c901b6e7 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 11:50:51 +0700 Subject: [PATCH 15/77] Flip Warning and Critical Calculation --- main.tf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.tf b/main.tf index 92b6c86..0226d56 100644 --- a/main.tf +++ b/main.tf @@ -14,8 +14,8 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 95 - critical = 75 + warning = 5 + critical = 25 nrql_query { account_id = var.account_id @@ -38,8 +38,8 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 5 - critical = 25 + warning = 95 + critical = 75 nrql_query { account_id = var.account_id @@ -62,8 +62,8 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 10 - critical = 25 + warning = 90 + critical = 75 nrql_query { account_id = var.account_id From 49b444152a3292c68efd7145f00d2f08185d7e7b Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 11:55:36 +0700 Subject: [PATCH 16/77] Fix Color Rate --- main.tf | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/main.tf b/main.tf index 0226d56..01046f4 100644 --- a/main.tf +++ b/main.tf @@ -14,8 +14,8 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 5 - critical = 25 + warning = 95 + critical = 75 nrql_query { account_id = var.account_id @@ -38,9 +38,6 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 95 - critical = 75 - nrql_query { account_id = var.account_id query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" @@ -62,9 +59,6 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 90 - critical = 75 - nrql_query { account_id = var.account_id query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" From 8cce3289ad6a6f94d237f994f20778ab65fac86b Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 12:12:34 +0700 Subject: [PATCH 17/77] Fix Color Rate 2 --- main.tf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 01046f4..8ab2a64 100644 --- a/main.tf +++ b/main.tf @@ -14,9 +14,6 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 95 - critical = 75 - nrql_query { account_id = var.account_id query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" @@ -38,6 +35,9 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 + warning = 5 + critical = 25 + nrql_query { account_id = var.account_id query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" @@ -59,6 +59,9 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 + warning = 25 + critical = 50 + nrql_query { account_id = var.account_id query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" From 15486bc1365200978578e75e574c37a895033634 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 12:13:03 +0700 Subject: [PATCH 18/77] Move Summary Page --- main.tf | 138 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/main.tf b/main.tf index 8ab2a64..49e9799 100644 --- a/main.tf +++ b/main.tf @@ -1,75 +1,6 @@ resource "newrelic_one_dashboard" "main" { name = var.dashboard_name - page { - name = "Success Rate" - description = "Rate => metric_status = success + expected_error" - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - } - - page { - name = "Error Rate" - description = "Rate => metric_status = error" - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 4 - - warning = 5 - critical = 25 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - } - - page { - name = "Real Error Rate" - description = "Rate => metric_status = error + expected_error" - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 4 - - warning = 25 - critical = 50 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - } - page { name = "Summary" @@ -202,6 +133,75 @@ resource "newrelic_one_dashboard" "main" { } } + page { + name = "Success Rate" + description = "Rate => metric_status = success + expected_error" + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + } + + page { + name = "Error Rate" + description = "Rate => metric_status = error" + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 4 + + warning = 5 + critical = 25 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + } + + page { + name = "Real Error Rate" + description = "Rate => metric_status = error + expected_error" + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 4 + + warning = 25 + critical = 50 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + } + # page { # name = "Detail" # } From 3d67318a8755c87be92856ac0919c2c33c5c9512 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 12:18:39 +0700 Subject: [PATCH 19/77] Remove Color --- main.tf | 9 --------- 1 file changed, 9 deletions(-) diff --git a/main.tf b/main.tf index 49e9799..d730b6a 100644 --- a/main.tf +++ b/main.tf @@ -32,9 +32,6 @@ resource "newrelic_one_dashboard" "main" { row = 2 column = 1 - warning = 95 - critical = 75 - nrql_query { account_id = var.account_id query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Success Rate' from ${var.event_name}" @@ -167,9 +164,6 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 5 - critical = 25 - nrql_query { account_id = var.account_id query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" @@ -191,9 +185,6 @@ resource "newrelic_one_dashboard" "main" { column = 1 + ((widget_billboard.key % 3) * 4) width = 4 - warning = 25 - critical = 50 - nrql_query { account_id = var.account_id query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" From 4279b6b04b8d117192f91b53c1e2f4fc08c6f12a Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 12:26:10 +0700 Subject: [PATCH 20/77] Reduce Height --- main.tf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index d730b6a..0aac93a 100644 --- a/main.tf +++ b/main.tf @@ -34,7 +34,7 @@ resource "newrelic_one_dashboard" "main" { nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Success Rate' from ${var.event_name}" + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name}" } } @@ -142,6 +142,7 @@ resource "newrelic_one_dashboard" "main" { row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 4 + height = 2 nrql_query { account_id = var.account_id @@ -163,6 +164,7 @@ resource "newrelic_one_dashboard" "main" { row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 4 + height = 2 nrql_query { account_id = var.account_id @@ -184,6 +186,7 @@ resource "newrelic_one_dashboard" "main" { row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 4 + height = 2 nrql_query { account_id = var.account_id From b823f9a04f5a4a677a99f3745f8c9a452f11bd1a Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 13:33:42 +0700 Subject: [PATCH 21/77] Revamp Summary Page --- main.tf | 80 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/main.tf b/main.tf index 0aac93a..bff198d 100644 --- a/main.tf +++ b/main.tf @@ -5,43 +5,45 @@ resource "newrelic_one_dashboard" "main" { name = "Summary" widget_billboard { - title = "Requests per minute" + title = "Success rate" row = 1 column = 1 + width = 2 nrql_query { account_id = var.account_id - query = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName = '${var.service_name}'" + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name}" } } - widget_table { - title = "Requests per minute, by transaction" + widget_billboard { + title = "Requests per minute" row = 1 - column = 5 - width = 8 + column = 3 + width = 2 nrql_query { account_id = var.account_id - query = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName = '${var.service_name}' FACET name" + query = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName = '${var.service_name}'" } } - widget_billboard { - title = "Success rate" - row = 2 - column = 1 + widget_table { + title = "Requests per minute, by transaction" + row = 1 + column = 5 + width = 8 nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name}" + query = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName = '${var.service_name}' FACET name" } } widget_pie { title = "Metric status percentage" row = 2 - column = 5 + column = 1 nrql_query { account_id = var.account_id @@ -52,7 +54,7 @@ resource "newrelic_one_dashboard" "main" { widget_line { title = "Metric status histogram" row = 2 - column = 9 + column = 5 nrql_query { account_id = var.account_id @@ -62,72 +64,72 @@ resource "newrelic_one_dashboard" "main" { widget_table { title = "Method with most errors" - row = 3 - column = 1 - width = 6 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `method` LIMIT 10 EXTRAPOLATE" - } - } - - widget_table { - title = "Human error message with most occurrence" - row = 3 - column = 7 - width = 6 + row = 2 + column = 9 nrql_query { account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `message` LIMIT 10 EXTRAPOLATE" + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `method` LIMIT 10 EXTRAPOLATE" } } widget_bar { title = "Error with most occurrence" - row = 4 + row = 3 column = 1 nrql_query { account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `err` LIMIT 10 EXTRAPOLATE" + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `err` LIMIT 10 EXTRAPOLATE" } } widget_bar { title = "Error code with most occurrence" - row = 4 + row = 3 column = 5 nrql_query { account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `code` LIMIT 10 EXTRAPOLATE" + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" } } widget_bar { title = "Operation with most errors" - row = 4 + row = 3 column = 9 nrql_query { account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `ops` LIMIT 10 EXTRAPOLATE" + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `ops` LIMIT 10 EXTRAPOLATE" } } widget_table { title = "Line with most errors" - row = 5 + row = 4 column = 1 - width = 12 + width = 6 nrql_query { account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' or metric_status = 'expected_error' FACET `err_line` LIMIT 10 EXTRAPOLATE" + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `err_line` LIMIT 10 EXTRAPOLATE" } } + + widget_table { + title = "Human error message with most occurrence" + row = 4 + column = 7 + width = 6 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `message` LIMIT 10 EXTRAPOLATE" + } + } + } page { From 56dfc412ccc4e2628a6b68d02ae314dd7effb2fc Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 13:48:29 +0700 Subject: [PATCH 22/77] Add Timeseries --- main.tf | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index bff198d..711d02e 100644 --- a/main.tf +++ b/main.tf @@ -143,7 +143,7 @@ resource "newrelic_one_dashboard" "main" { title = widget_billboard.value row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) - width = 4 + width = 1 height = 2 nrql_query { @@ -152,6 +152,23 @@ resource "newrelic_one_dashboard" "main" { } } } + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = widget_line.value + row = var.base_row + floor(widget_line.key / 3) + column = 2 + ((widget_line.key % 3) * 4) + width = 3 + height = 2 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + } + } + } } page { From 8fea5e071ffb0f323aeb4c792f19a821094daeb1 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 13:57:25 +0700 Subject: [PATCH 23/77] Add Timeseries 2 --- main.tf | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/main.tf b/main.tf index 711d02e..6a7d3b2 100644 --- a/main.tf +++ b/main.tf @@ -144,7 +144,6 @@ resource "newrelic_one_dashboard" "main" { row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 - height = 2 nrql_query { account_id = var.account_id @@ -153,19 +152,18 @@ resource "newrelic_one_dashboard" "main" { } } - dynamic "widget_line" { + dynamic "widget_area" { for_each = var.event_methods content { - title = widget_line.value - row = var.base_row + floor(widget_line.key / 3) - column = 2 + ((widget_line.key % 3) * 4) + title = widget_area.value + row = var.base_row + floor(widget_area.key / 3) + column = 2 + ((widget_area.key % 3) * 4) width = 3 - height = 2 nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_area.value}' EXTRAPOLATE TIMESERIES" } } } @@ -191,6 +189,22 @@ resource "newrelic_one_dashboard" "main" { } } } + + dynamic "widget_area" { + for_each = var.event_methods + + content { + title = widget_area.value + row = var.base_row + floor(widget_area.key / 3) + column = 2 + ((widget_area.key % 3) * 4) + width = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_area.value}' EXTRAPOLATE TIMESERIES" + } + } + } } page { @@ -213,6 +227,22 @@ resource "newrelic_one_dashboard" "main" { } } } + + dynamic "widget_area" { + for_each = var.event_methods + + content { + title = widget_area.value + row = var.base_row + floor(widget_area.key / 3) + column = 2 + ((widget_area.key % 3) * 4) + width = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_area.value}' EXTRAPOLATE TIMESERIES" + } + } + } } # page { From 5dc65df28638bf48b0e9bb7d2cfaac97e420eeff Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 13:59:44 +0700 Subject: [PATCH 24/77] Fix Width and Height --- main.tf | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index 6a7d3b2..758e4ed 100644 --- a/main.tf +++ b/main.tf @@ -180,8 +180,7 @@ resource "newrelic_one_dashboard" "main" { title = widget_billboard.value row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) - width = 4 - height = 2 + width = 1 nrql_query { account_id = var.account_id @@ -218,8 +217,7 @@ resource "newrelic_one_dashboard" "main" { title = widget_billboard.value row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) - width = 4 - height = 2 + width = 1 nrql_query { account_id = var.account_id From 2af0d9fe5e3f96bc016ddafc9a7057d98c89d1df Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 14:18:43 +0700 Subject: [PATCH 25/77] Remove Useless Pages --- main.tf | 74 +++++++-------------------------------------------------- 1 file changed, 9 insertions(+), 65 deletions(-) diff --git a/main.tf b/main.tf index 758e4ed..2231c6c 100644 --- a/main.tf +++ b/main.tf @@ -144,6 +144,7 @@ resource "newrelic_one_dashboard" "main" { row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 + height = 2 nrql_query { account_id = var.account_id @@ -152,92 +153,35 @@ resource "newrelic_one_dashboard" "main" { } } - dynamic "widget_area" { - for_each = var.event_methods - - content { - title = widget_area.value - row = var.base_row + floor(widget_area.key / 3) - column = 2 + ((widget_area.key % 3) * 4) - width = 3 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_area.value}' EXTRAPOLATE TIMESERIES" - } - } - } - } - - page { - name = "Error Rate" - description = "Rate => metric_status = error" - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_area" { - for_each = var.event_methods - - content { - title = widget_area.value - row = var.base_row + floor(widget_area.key / 3) - column = 2 + ((widget_area.key % 3) * 4) - width = 3 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status = 'error') as 'Error Rate' from ${var.event_name} WHERE method = '${widget_area.value}' EXTRAPOLATE TIMESERIES" - } - } - } - } - - page { - name = "Real Error Rate" - description = "Rate => metric_status = error + expected_error" - dynamic "widget_billboard" { for_each = var.event_methods content { title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) + row = 1 + var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 + height = 2 nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } - dynamic "widget_area" { + dynamic "widget_line" { for_each = var.event_methods content { - title = widget_area.value - row = var.base_row + floor(widget_area.key / 3) - column = 2 + ((widget_area.key % 3) * 4) + title = widget_line.value + row = var.base_row + floor(widget_line.key / 3) + column = 2 + ((widget_line.key % 3) * 4) width = 3 nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('error', 'expected_error')) as 'Real Error Rate' from ${var.event_name} WHERE method = '${widget_area.value}' EXTRAPOLATE TIMESERIES" + query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" } } } From b0c05a24482163f6df4d9c78b4c0a88fc338d19a Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 14:22:32 +0700 Subject: [PATCH 26/77] Change Size --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 2231c6c..bbd65d5 100644 --- a/main.tf +++ b/main.tf @@ -161,7 +161,7 @@ resource "newrelic_one_dashboard" "main" { row = 1 + var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id From 0b684d488277561afdd96e33a028c2e7f1342fde Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 14:32:28 +0700 Subject: [PATCH 27/77] Add Count --- main.tf | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/main.tf b/main.tf index bbd65d5..fbbdace 100644 --- a/main.tf +++ b/main.tf @@ -133,8 +133,7 @@ resource "newrelic_one_dashboard" "main" { } page { - name = "Success Rate" - description = "Rate => metric_status = success + expected_error" + name = "Overview" dynamic "widget_billboard" { for_each = var.event_methods @@ -144,11 +143,11 @@ resource "newrelic_one_dashboard" "main" { row = var.base_row + floor(widget_billboard.key / 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + query = "SELECT count(*) 'Count' from ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } @@ -165,7 +164,24 @@ resource "newrelic_one_dashboard" "main" { nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error Rate' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = 2 + var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } From 87e93390914dec5c113e3bc3bd118a9a6a639843 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 15:01:17 +0700 Subject: [PATCH 28/77] Add Success Rate Page --- main.tf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/main.tf b/main.tf index fbbdace..8cbe890 100644 --- a/main.tf +++ b/main.tf @@ -129,7 +129,27 @@ resource "newrelic_one_dashboard" "main" { query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `message` LIMIT 10 EXTRAPOLATE" } } + } + + page { + name = "Success Rate" + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 4 + height = 2 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } } page { From c616940d6ec5e94f8d69aca9e1f67f81a638df41 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 15:28:39 +0700 Subject: [PATCH 29/77] Comment Out Everything --- main.tf | 182 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/main.tf b/main.tf index 8cbe890..50e9847 100644 --- a/main.tf +++ b/main.tf @@ -131,97 +131,97 @@ resource "newrelic_one_dashboard" "main" { } } - page { - name = "Success Rate" - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 4 - height = 2 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - } - - page { - name = "Overview" - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) 'Count' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = 1 + var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = 2 + var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_line" { - for_each = var.event_methods - - content { - title = widget_line.value - row = var.base_row + floor(widget_line.key / 3) - column = 2 + ((widget_line.key % 3) * 4) - width = 3 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" - } - } - } - } + # page { + # name = "Success Rate" + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = widget_billboard.value + # row = var.base_row + floor(widget_billboard.key / 3) + # column = 1 + ((widget_billboard.key % 3) * 4) + # width = 4 + # height = 2 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # } + # + # page { + # name = "Overview" + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = widget_billboard.value + # row = var.base_row + floor(widget_billboard.key / 3) + # column = 1 + ((widget_billboard.key % 3) * 4) + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) 'Count' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = widget_billboard.value + # row = 1 + var.base_row + floor(widget_billboard.key / 3) + # column = 1 + ((widget_billboard.key % 3) * 4) + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = widget_billboard.value + # row = 2 + var.base_row + floor(widget_billboard.key / 3) + # column = 1 + ((widget_billboard.key % 3) * 4) + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_line" { + # for_each = var.event_methods + # + # content { + # title = widget_line.value + # row = var.base_row + floor(widget_line.key / 3) + # column = 2 + ((widget_line.key % 3) * 4) + # width = 3 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + # } + # } + # } + # } # page { # name = "Detail" From 25e6ec786279fa9efcc40cff501b40b9eced83c6 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 15:32:05 +0700 Subject: [PATCH 30/77] Add Success Rate Page --- main.tf | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/main.tf b/main.tf index 50e9847..508f157 100644 --- a/main.tf +++ b/main.tf @@ -131,27 +131,27 @@ resource "newrelic_one_dashboard" "main" { } } - # page { - # name = "Success Rate" - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = widget_billboard.value - # row = var.base_row + floor(widget_billboard.key / 3) - # column = 1 + ((widget_billboard.key % 3) * 4) - # width = 4 - # height = 2 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # } - # + page { + name = "Success Rate" + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 4 + height = 2 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + } + # page { # name = "Overview" # From e3de53238f32f721899758318053c22a375268a4 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 15:34:20 +0700 Subject: [PATCH 31/77] Add Timeline Page --- main.tf | 106 +++++++++++++++++++------------------------------------- 1 file changed, 36 insertions(+), 70 deletions(-) diff --git a/main.tf b/main.tf index 508f157..e06446e 100644 --- a/main.tf +++ b/main.tf @@ -152,76 +152,42 @@ resource "newrelic_one_dashboard" "main" { } } - # page { - # name = "Overview" - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = widget_billboard.value - # row = var.base_row + floor(widget_billboard.key / 3) - # column = 1 + ((widget_billboard.key % 3) * 4) - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) 'Count' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = widget_billboard.value - # row = 1 + var.base_row + floor(widget_billboard.key / 3) - # column = 1 + ((widget_billboard.key % 3) * 4) - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = widget_billboard.value - # row = 2 + var.base_row + floor(widget_billboard.key / 3) - # column = 1 + ((widget_billboard.key % 3) * 4) - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_line" { - # for_each = var.event_methods - # - # content { - # title = widget_line.value - # row = var.base_row + floor(widget_line.key / 3) - # column = 2 + ((widget_line.key % 3) * 4) - # width = 3 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" - # } - # } - # } - # } + page { + name = "Timeline" + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = widget_line.value + row = var.base_row + floor(widget_line.key / 3) + column = 2 + ((widget_line.key % 3) * 4) + width = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + } + } + } + } # page { # name = "Detail" From 5e11e72983cba871fdfc71134d41824526d749db Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 15:35:24 +0700 Subject: [PATCH 32/77] Remove Success Rate Page --- main.tf | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/main.tf b/main.tf index e06446e..494cbfb 100644 --- a/main.tf +++ b/main.tf @@ -131,27 +131,6 @@ resource "newrelic_one_dashboard" "main" { } } - page { - name = "Success Rate" - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 4 - height = 2 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - } - page { name = "Timeline" From c34b68b4cbb13d9d90b5189c0af164368669b555 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 17:26:49 +0700 Subject: [PATCH 33/77] Finish Row1 and 2 --- main.tf | 80 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/main.tf b/main.tf index 494cbfb..ac7c0fa 100644 --- a/main.tf +++ b/main.tf @@ -4,35 +4,37 @@ resource "newrelic_one_dashboard" "main" { page { name = "Summary" + // 1 + widget_billboard { - title = "Success rate" + title = "Requests per minute" row = 1 column = 1 width = 2 nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name}" + query = "SELECT rate(count(*), 1 minute) AS 'RPM' FROM Transaction WHERE appName = '${var.service_name}'" } } - widget_billboard { - title = "Requests per minute" + widget_line { + title = "Requests per minute histogram" row = 1 column = 3 - width = 2 + width = 4 nrql_query { account_id = var.account_id - query = "SELECT rate(count(*), 1 minute) FROM Transaction WHERE appName = '${var.service_name}'" + query = "SELECT rate(count(*), 1 minute) AS 'RPM' FROM Transaction WHERE appName = '${var.service_name}' TIMESERIES EXTRAPOLATE COMPARE WITH 1 week ago" } } widget_table { - title = "Requests per minute, by transaction" + title = "Requests per minute by transaction" row = 1 - column = 5 - width = 8 + column = 7 + width = 6 nrql_query { account_id = var.account_id @@ -40,10 +42,25 @@ resource "newrelic_one_dashboard" "main" { } } + // 2 + + widget_billboard { + title = "Success rate = success + expected_error" + row = 2 + column = 1 + width = 2 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success Rate' from ${var.event_name}" + } + } + widget_pie { title = "Metric status percentage" row = 2 - column = 1 + column = 3 + width = 4 nrql_query { account_id = var.account_id @@ -54,18 +71,22 @@ resource "newrelic_one_dashboard" "main" { widget_line { title = "Metric status histogram" row = 2 - column = 5 + column = 7 + width = 6 nrql_query { account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} FACET `metric_status` LIMIT 10 EXTRAPOLATE TIMESERIES" + query = "SELECT count(*) FROM ${var.event_name} FACET `metric_status` EXTRAPOLATE TIMESERIES" } } + // 3 + widget_table { title = "Method with most errors" row = 2 - column = 9 + column = 7 + width = 6 nrql_query { account_id = var.account_id @@ -73,21 +94,23 @@ resource "newrelic_one_dashboard" "main" { } } - widget_bar { - title = "Error with most occurrence" + widget_billboard { + title = "Error count" row = 3 column = 1 + width = 2 nrql_query { account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `err` LIMIT 10 EXTRAPOLATE" + query = "SELECT filter(count(*), WHERE metric_status IN ('error')) as 'Error count' from ${var.event_name}" } } - widget_bar { + widget_table { title = "Error code with most occurrence" row = 3 - column = 5 + column = 3 + width = 4 nrql_query { account_id = var.account_id @@ -95,6 +118,21 @@ resource "newrelic_one_dashboard" "main" { } } + # SELECT filter(count(*), WHERE metric_status = 'error') FROM digital_subscription_grpc_performance FACET `method` LIMIT 10 EXTRAPOLATE TIMESERIES + + widget_table { + title = "Error with most occurrence" + row = 3 + column = 7 + width = 6 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `err` LIMIT 10 EXTRAPOLATE" + } + } + + widget_bar { title = "Operation with most errors" row = 3 @@ -120,9 +158,9 @@ resource "newrelic_one_dashboard" "main" { widget_table { title = "Human error message with most occurrence" - row = 4 - column = 7 - width = 6 + row = 2 + column = 1 + width = 12 nrql_query { account_id = var.account_id From bd2dc2cf33f2f3eba13d93de916be63bc3b14fec Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 17:30:10 +0700 Subject: [PATCH 34/77] Finish Row 3 --- main.tf | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/main.tf b/main.tf index ac7c0fa..fdc345b 100644 --- a/main.tf +++ b/main.tf @@ -4,7 +4,7 @@ resource "newrelic_one_dashboard" "main" { page { name = "Summary" - // 1 + # 1 widget_billboard { title = "Requests per minute" @@ -42,7 +42,7 @@ resource "newrelic_one_dashboard" "main" { } } - // 2 + # 2 widget_billboard { title = "Success rate = success + expected_error" @@ -80,19 +80,7 @@ resource "newrelic_one_dashboard" "main" { } } - // 3 - - widget_table { - title = "Method with most errors" - row = 2 - column = 7 - width = 6 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `method` LIMIT 10 EXTRAPOLATE" - } - } + # 3 widget_billboard { title = "Error count" @@ -102,11 +90,11 @@ resource "newrelic_one_dashboard" "main" { nrql_query { account_id = var.account_id - query = "SELECT filter(count(*), WHERE metric_status IN ('error')) as 'Error count' from ${var.event_name}" + query = "SELECT count(*) as 'Error count' from ${var.event_name} WHERE metric_status IN ('error')" } } - widget_table { + gi "widget_pie" { title = "Error code with most occurrence" row = 3 column = 3 @@ -118,7 +106,19 @@ resource "newrelic_one_dashboard" "main" { } } - # SELECT filter(count(*), WHERE metric_status = 'error') FROM digital_subscription_grpc_performance FACET `method` LIMIT 10 EXTRAPOLATE TIMESERIES + widget_table { + title = "Method with most errors" + row = 3 + column = 7 + width = 6 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `method` LIMIT 10 EXTRAPOLATE" + } + } + + # 4 widget_table { title = "Error with most occurrence" From 4a1f6d5ff92f6d58d586e4a820a7e0f4e05da6b3 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 17:33:16 +0700 Subject: [PATCH 35/77] Finish Summary Page --- main.tf | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/main.tf b/main.tf index fdc345b..8333662 100644 --- a/main.tf +++ b/main.tf @@ -94,7 +94,7 @@ resource "newrelic_one_dashboard" "main" { } } - gi "widget_pie" { + widget_pie { title = "Error code with most occurrence" row = 3 column = 3 @@ -122,9 +122,9 @@ resource "newrelic_one_dashboard" "main" { widget_table { title = "Error with most occurrence" - row = 3 - column = 7 - width = 6 + row = 4 + column = 1 + width = 12 nrql_query { account_id = var.account_id @@ -132,11 +132,13 @@ resource "newrelic_one_dashboard" "main" { } } + # 5 widget_bar { title = "Operation with most errors" - row = 3 - column = 9 + row = 5 + column = 1 + width = 6 nrql_query { account_id = var.account_id @@ -146,8 +148,8 @@ resource "newrelic_one_dashboard" "main" { widget_table { title = "Line with most errors" - row = 4 - column = 1 + row = 5 + column = 7 width = 6 nrql_query { @@ -156,9 +158,11 @@ resource "newrelic_one_dashboard" "main" { } } + # 6 + widget_table { title = "Human error message with most occurrence" - row = 2 + row = 6 column = 1 width = 12 From e7add9fc65515e9698393306a5c2ae6deef4c0e6 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Fri, 12 Feb 2021 17:57:55 +0700 Subject: [PATCH 36/77] Change Widget Type --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 8333662..2cc83ba 100644 --- a/main.tf +++ b/main.tf @@ -120,7 +120,7 @@ resource "newrelic_one_dashboard" "main" { # 4 - widget_table { + widget_bar { title = "Error with most occurrence" row = 4 column = 1 @@ -146,7 +146,7 @@ resource "newrelic_one_dashboard" "main" { } } - widget_table { + widget_bar { title = "Line with most errors" row = 5 column = 7 @@ -160,7 +160,7 @@ resource "newrelic_one_dashboard" "main" { # 6 - widget_table { + widget_bar { title = "Human error message with most occurrence" row = 6 column = 1 From 67cfefa3f1312c082b191f69947068fc3d884a03 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 06:19:27 +0700 Subject: [PATCH 37/77] Downgrade Version --- versions.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.tf b/versions.tf index 65c22fd..3682606 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { newrelic = { source = "newrelic/newrelic" - version = "~> 2.18.0" + version = "~> 2.16.0" } } } \ No newline at end of file From eea39f1b533136aadf5a2a9d3f3e18a03021173b Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 06:31:34 +0700 Subject: [PATCH 38/77] Upgrade Again --- versions.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.tf b/versions.tf index 3682606..65c22fd 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { newrelic = { source = "newrelic/newrelic" - version = "~> 2.16.0" + version = "~> 2.18.0" } } } \ No newline at end of file From a62a557e151e055acecd8c8741058a5aed56174b Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 19:55:48 +0700 Subject: [PATCH 39/77] Improve Timeline --- main.tf | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/main.tf b/main.tf index 2cc83ba..dbddb34 100644 --- a/main.tf +++ b/main.tf @@ -193,6 +193,57 @@ resource "newrelic_one_dashboard" "main" { } } + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = 1 + var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = 2 + var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentile(duration, 95) * 1000 as ms from Transaction WHERE appName = '${var.service_name}' AND name = 'OtherTransaction/Go${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = widget_billboard.value + row = var.base_row + floor(widget_billboard.key / 3) + column = 1 + ((widget_billboard.key % 3) * 4) + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + dynamic "widget_line" { for_each = var.event_methods From 3c7353b3cf740609896bb6c1a3c3e9887af47ddc Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 20:01:13 +0700 Subject: [PATCH 40/77] Fix Row --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index dbddb34..6e69c9e 100644 --- a/main.tf +++ b/main.tf @@ -181,7 +181,7 @@ resource "newrelic_one_dashboard" "main" { content { title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) + row = var.base_row + ((widget_billboard.key - 1) * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -198,7 +198,7 @@ resource "newrelic_one_dashboard" "main" { content { title = widget_billboard.value - row = 1 + var.base_row + floor(widget_billboard.key / 3) + row = 1 + var.base_row + ((widget_billboard.key - 1) * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -215,7 +215,7 @@ resource "newrelic_one_dashboard" "main" { content { title = widget_billboard.value - row = 2 + var.base_row + floor(widget_billboard.key / 3) + row = 2 + var.base_row + ((widget_billboard.key - 1) * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 From 54922c7ac0e6f09bc21e00837ab8d4795b43a56d Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 20:04:43 +0700 Subject: [PATCH 41/77] Remove Duplicate --- main.tf | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/main.tf b/main.tf index 6e69c9e..562944f 100644 --- a/main.tf +++ b/main.tf @@ -227,23 +227,6 @@ resource "newrelic_one_dashboard" "main" { } } - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = widget_billboard.value - row = var.base_row + floor(widget_billboard.key / 3) - column = 1 + ((widget_billboard.key % 3) * 4) - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - dynamic "widget_line" { for_each = var.event_methods From 6620ced27975cd9fdd1359a97a25f4b90cd012a3 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 20:16:14 +0700 Subject: [PATCH 42/77] Fix Index --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 562944f..6ba076f 100644 --- a/main.tf +++ b/main.tf @@ -181,7 +181,7 @@ resource "newrelic_one_dashboard" "main" { content { title = widget_billboard.value - row = var.base_row + ((widget_billboard.key - 1) * 3) + row = var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -198,7 +198,7 @@ resource "newrelic_one_dashboard" "main" { content { title = widget_billboard.value - row = 1 + var.base_row + ((widget_billboard.key - 1) * 3) + row = 1 + var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -215,7 +215,7 @@ resource "newrelic_one_dashboard" "main" { content { title = widget_billboard.value - row = 2 + var.base_row + ((widget_billboard.key - 1) * 3) + row = 2 + var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 From a1c77cced17841d3ff92c79a198b479e7c06086a Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 20:31:08 +0700 Subject: [PATCH 43/77] Better Name --- main.tf | 2 +- variables.tf | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 6ba076f..fd48520 100644 --- a/main.tf +++ b/main.tf @@ -231,7 +231,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = widget_line.value + title = replace(widget_line.value, var.event_name_substring, var.event_name_replace) row = var.base_row + floor(widget_line.key / 3) column = 2 + ((widget_line.key % 3) * 4) width = 3 diff --git a/variables.tf b/variables.tf index cbebb51..7c28143 100644 --- a/variables.tf +++ b/variables.tf @@ -30,4 +30,12 @@ variable "base_row" { variable "total_column_per_method" { type = number default = 9 +} + +variable "event_name_substring" { + type = string +} + +variable "event_name_replace" { + type = string } \ No newline at end of file From ca10920af02e35dc7a637a2ae3eaa5e89c54b4e6 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 20:35:08 +0700 Subject: [PATCH 44/77] Better Name v2 --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index fd48520..2cc6971 100644 --- a/main.tf +++ b/main.tf @@ -180,7 +180,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = widget_billboard.value + title = var.event_name_substring != "" ? replace(widget_billboard.value, var.event_name_substring, var.event_name_replace) : widget_billboard.value row = var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 @@ -197,7 +197,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = widget_billboard.value + title = var.event_name_substring != "" ? replace(widget_billboard.value, var.event_name_substring, var.event_name_replace) : widget_billboard.value row = 1 + var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 @@ -214,7 +214,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = widget_billboard.value + title = var.event_name_substring != "" ? replace(widget_billboard.value, var.event_name_substring, var.event_name_replace) : widget_billboard.value row = 2 + var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 @@ -231,7 +231,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = replace(widget_line.value, var.event_name_substring, var.event_name_replace) + title = var.event_name_substring != "" ? replace(widget_line.value, var.event_name_substring, var.event_name_replace) : widget_line.value row = var.base_row + floor(widget_line.key / 3) column = 2 + ((widget_line.key % 3) * 4) width = 3 From 03f431e6fab3076067a864861cdf0ab5aaa67f39 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 20:42:23 +0700 Subject: [PATCH 45/77] Rename Wrong Variable Name --- main.tf | 8 ++++---- variables.tf | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.tf b/main.tf index 2cc6971..c8b95cd 100644 --- a/main.tf +++ b/main.tf @@ -180,7 +180,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = var.event_name_substring != "" ? replace(widget_billboard.value, var.event_name_substring, var.event_name_replace) : widget_billboard.value + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 @@ -197,7 +197,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = var.event_name_substring != "" ? replace(widget_billboard.value, var.event_name_substring, var.event_name_replace) : widget_billboard.value + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 1 + var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 @@ -214,7 +214,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = var.event_name_substring != "" ? replace(widget_billboard.value, var.event_name_substring, var.event_name_replace) : widget_billboard.value + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 2 + var.base_row + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 @@ -231,7 +231,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = var.event_name_substring != "" ? replace(widget_line.value, var.event_name_substring, var.event_name_replace) : widget_line.value + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value row = var.base_row + floor(widget_line.key / 3) column = 2 + ((widget_line.key % 3) * 4) width = 3 diff --git a/variables.tf b/variables.tf index 7c28143..b051d1e 100644 --- a/variables.tf +++ b/variables.tf @@ -32,10 +32,10 @@ variable "total_column_per_method" { default = 9 } -variable "event_name_substring" { +variable "event_method_substring" { type = string } -variable "event_name_replace" { +variable "event_method_replace" { type = string } \ No newline at end of file From ba0027e832fb89c83d14a72bbd96edfe33f16cb8 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 20:53:21 +0700 Subject: [PATCH 46/77] Improve README --- README.md | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ef8189d..48d4d0a 100644 --- a/README.md +++ b/README.md @@ -13,31 +13,38 @@ data "newrelic_entity" "app_grpc" { } module "grpc_dashboard" { - source = "git::https://github.com/rizalgowandy/terraform-peractio-newrelic?ref=v0.0.2" - - # Replace with your service name. - service_name = "app_grpc" + source = "git::https://github.com/rizalgowandy/terraform-peractio-newrelic?ref=v0.1.0" + # Replace with your account id. + account_id = 123456 # Replace with your application id. application_id = data.newrelic_entity.app_grpc.application_id - # Replace with your metric name. - event_name = "grpc_performance" + # Replace with your dashboard name, should be unique for your account. + dashboard_name = "app_grpc" + service_name = "app_grpc" + # Replace with your metric name. + event_name = "grpc_performance" + # Help make widget name more feasible with replacing long method name. + # Example: + # "/inventory.v1.Inventory/GetProducts" => "/v1.Inventory/GetProducts" + event_name_substring = "/inventory./" + event_name_replace = "" # Replace with your metric method name. - event_methods = [ + event_methods = [ "/inventory.v1.Inventory/GetProducts", "/inventory.v1.Inventory/CheckStocks", ] } ``` -### Required Event Tags +### Standardized Event Tags -- metric_status -- method -- ops -- code -- err -- err_line -- message +- metric_status => `ENUM('success', 'error', 'expected_error')` +- method => e.g `"/inventory.v1.Inventory/GetProducts"` +- ops => e.g `"service/Inventory.GetProductDetail"` +- code => e.g `'invalid'`, and `'not_found'` +- err => the value of `error.Error()` +- err_line => e.g `"/inventory-mgmt/internal/service/inventory.go:634"` +- message => humanize error message From cf1ba56b2e68ced43f74287a47ca79fe7a360dfe Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 21:00:56 +0700 Subject: [PATCH 47/77] Fix README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 48d4d0a..1b1e069 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ module "grpc_dashboard" { # Help make widget name more feasible with replacing long method name. # Example: # "/inventory.v1.Inventory/GetProducts" => "/v1.Inventory/GetProducts" - event_name_substring = "/inventory./" - event_name_replace = "" + event_method_substring = "/inventory./" + event_method_replace = "" # Replace with your metric method name. event_methods = [ "/inventory.v1.Inventory/GetProducts", From 4ba5c4708fd91677940ddd9f568454479e2d68f6 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 21:13:49 +0700 Subject: [PATCH 48/77] More Compact Summary --- main.tf | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/main.tf b/main.tf index c8b95cd..943c26c 100644 --- a/main.tf +++ b/main.tf @@ -124,7 +124,7 @@ resource "newrelic_one_dashboard" "main" { title = "Error with most occurrence" row = 4 column = 1 - width = 12 + width = 6 nrql_query { account_id = var.account_id @@ -132,6 +132,18 @@ resource "newrelic_one_dashboard" "main" { } } + widget_bar { + title = "Human error message with most occurrence" + row = 4 + column = 7 + width = 6 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `message` LIMIT 10 EXTRAPOLATE" + } + } + # 5 widget_bar { @@ -157,20 +169,6 @@ resource "newrelic_one_dashboard" "main" { query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `err_line` LIMIT 10 EXTRAPOLATE" } } - - # 6 - - widget_bar { - title = "Human error message with most occurrence" - row = 6 - column = 1 - width = 12 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `message` LIMIT 10 EXTRAPOLATE" - } - } } page { From 45f15db0c3f42012079d31c41c45714c1a4cef77 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 22:10:02 +0700 Subject: [PATCH 49/77] Add Detail Page --- main.tf | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index 943c26c..e3c30ca 100644 --- a/main.tf +++ b/main.tf @@ -220,7 +220,7 @@ resource "newrelic_one_dashboard" "main" { nrql_query { account_id = var.account_id - query = "SELECT percentile(duration, 95) * 1000 as ms from Transaction WHERE appName = '${var.service_name}' AND name = 'OtherTransaction/Go${widget_billboard.value}'" + query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } @@ -242,9 +242,79 @@ resource "newrelic_one_dashboard" "main" { } } - # page { - # name = "Detail" - # } + page { + name = "Detail" + + # 1 + + # 2 + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = (var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value) + " error with most occurrence" + row = 1 + var.base_row + (widget_bar.key * 2) + column = 1 + width = 6 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = (var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value) + " human error message with most occurrence" + row = 1 + var.base_row + (widget_bar.key * 2) + column = 7 + width = 6 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + } + } + } + + # 3 + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = (var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value) + " operation with most errors" + row = 2 + var.base_row + (widget_bar.key * 2) + column = 1 + width = 6 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = (var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value) + " line with most errors" + row = 2 + var.base_row + (widget_bar.key * 2) + column = 7 + width = 6 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + } + } + } + } } #resource "newrelic_dashboard" "main" { From 1db5ce9e94eae2dca0edcb1b618bacfd44355397 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 22:12:19 +0700 Subject: [PATCH 50/77] Fix Title --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index e3c30ca..f7463a6 100644 --- a/main.tf +++ b/main.tf @@ -253,7 +253,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = (var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value) + " error with most occurrence" + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} error with most occurrence" row = 1 + var.base_row + (widget_bar.key * 2) column = 1 width = 6 @@ -269,7 +269,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = (var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value) + " human error message with most occurrence" + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} human error message with most occurrence" row = 1 + var.base_row + (widget_bar.key * 2) column = 7 width = 6 @@ -287,7 +287,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = (var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value) + " operation with most errors" + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} operation with most errors" row = 2 + var.base_row + (widget_bar.key * 2) column = 1 width = 6 @@ -303,7 +303,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = (var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value) + " line with most errors" + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} line with most errors" row = 2 + var.base_row + (widget_bar.key * 2) column = 7 width = 6 From dfa9c2b9b4598cd3e6b82c4c0eff7ae17deccef0 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 22:15:26 +0700 Subject: [PATCH 51/77] Better Title --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index f7463a6..c267539 100644 --- a/main.tf +++ b/main.tf @@ -253,7 +253,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} error with most occurrence" + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" row = 1 + var.base_row + (widget_bar.key * 2) column = 1 width = 6 @@ -269,7 +269,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} human error message with most occurrence" + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" row = 1 + var.base_row + (widget_bar.key * 2) column = 7 width = 6 @@ -287,7 +287,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} operation with most errors" + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" row = 2 + var.base_row + (widget_bar.key * 2) column = 1 width = 6 @@ -303,7 +303,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} line with most errors" + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" row = 2 + var.base_row + (widget_bar.key * 2) column = 7 width = 6 From 9fbab645137c0ce669052aecf0dcff806c395454 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 22:21:06 +0700 Subject: [PATCH 52/77] Add Color for 95 --- main.tf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.tf b/main.tf index c267539..7380301 100644 --- a/main.tf +++ b/main.tf @@ -218,6 +218,9 @@ resource "newrelic_one_dashboard" "main" { width = 1 height = 1 + warning = 1000 + critical = 2000 + nrql_query { account_id = var.account_id query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" From f0240cfdcd430e47a342bd00cb1e7dda314b04e2 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 22:45:18 +0700 Subject: [PATCH 53/77] Finish Detail Page --- main.tf | 375 +++++++++++++++++++++++++++++++++++---------------- variables.tf | 10 -- 2 files changed, 256 insertions(+), 129 deletions(-) diff --git a/main.tf b/main.tf index 7380301..a48949a 100644 --- a/main.tf +++ b/main.tf @@ -179,7 +179,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = var.base_row + (widget_billboard.key * 3) + row = 1 + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -196,7 +196,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + var.base_row + (widget_billboard.key * 3) + row = 1 + 1 + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -213,7 +213,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + var.base_row + (widget_billboard.key * 3) + row = 2 + 1 + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -233,7 +233,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = var.base_row + floor(widget_line.key / 3) + row = 1 + floor(widget_line.key / 3) column = 2 + ((widget_line.key % 3) * 4) width = 3 @@ -250,6 +250,254 @@ resource "newrelic_one_dashboard" "main" { # 1 + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 5) + column = 1 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 5) + column = 2 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Pure Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 5) + column = 3 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 5) + column = 4 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + 1 + (widget_billboard.key * 5) + column = 1 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + 1 + (widget_billboard.key * 5) + column = 2 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + 1 + (widget_billboard.key * 5) + column = 3 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + 1 + (widget_billboard.key * 5) + column = 4 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + 1 + (widget_billboard.key * 5) + column = 1 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + 1 + (widget_billboard.key * 5) + column = 2 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + 1 + (widget_billboard.key * 5) + column = 3 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + 1 + (widget_billboard.key * 5) + column = 4 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 1 + (widget_line.key * 3) + column = 5 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error code with most occurrence" + row = 1 + (widget_bar.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" + } + } + } + # 2 dynamic "widget_bar" { @@ -257,7 +505,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - row = 1 + var.base_row + (widget_bar.key * 2) + row = 3 + 1 + (widget_bar.key * 5) column = 1 width = 6 @@ -273,7 +521,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 1 + var.base_row + (widget_bar.key * 2) + row = 1 + 1 + (widget_bar.key * 3) column = 7 width = 6 @@ -291,7 +539,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - row = 2 + var.base_row + (widget_bar.key * 2) + row = 4 + 1 + (widget_bar.key * 5) column = 1 width = 6 @@ -307,7 +555,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 2 + var.base_row + (widget_bar.key * 2) + row = 2 + 1 + (widget_bar.key * 3) column = 7 width = 6 @@ -319,114 +567,3 @@ resource "newrelic_one_dashboard" "main" { } } } - -#resource "newrelic_dashboard" "main" { -# title = var.dashboard_name -# -# ##################### -# # Event widgets. -# ##################### -# -# # First rows. -# -# dynamic "widget" { -# for_each = var.event_methods -# -# content { -# title = "${widget.value} request per minute" -# visualization = "billboard" -# nrql = "SELECT rate(count(*), 1 minute) FROM ${var.event_name} WHERE method = '${widget.value}'" -# row = var.base_row + widget.key * (var.total_column_per_method / 3) -# column = 1 -# } -# } -# -# dynamic "widget" { -# for_each = var.event_methods -# -# content { -# title = "${widget.value} metric status percentage" -# visualization = "facet_pie_chart" -# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method = '${widget.value}' FACET `metric_status` LIMIT 10 EXTRAPOLATE" -# row = var.base_row + widget.key * (var.total_column_per_method / 3) -# column = 2 -# } -# } -# -# dynamic "widget" { -# for_each = var.event_methods -# -# content { -# title = "${widget.value} metric status histogram" -# visualization = "faceted_line_chart" -# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method = '${widget.value}' FACET `metric_status` LIMIT 10 EXTRAPOLATE TIMESERIES" -# row = var.base_row + widget.key * (var.total_column_per_method / 3) -# column = 3 -# } -# } -# -# # Second rows. -# -# dynamic "widget" { -# for_each = var.event_methods -# -# content { -# title = "${widget.value} error with most occurrence" -# visualization = "facet_bar_chart" -# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `err` LIMIT 10 EXTRAPOLATE" -# row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) -# column = 1 -# } -# } -# -# dynamic "widget" { -# for_each = var.event_methods -# -# content { -# title = "${widget.value} error code with most occurrence" -# visualization = "facet_bar_chart" -# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `code` LIMIT 10 EXTRAPOLATE" -# row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) -# column = 2 -# } -# } -# -# dynamic "widget" { -# for_each = var.event_methods -# -# content { -# title = "${widget.value} human error message with most occurrence" -# visualization = "facet_table" -# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `message` LIMIT 10 EXTRAPOLATE" -# row = 1 + var.base_row + widget.key * (var.total_column_per_method / 3) -# column = 3 -# } -# } -# -# # Third rows. -# -# dynamic "widget" { -# for_each = var.event_methods -# -# content { -# title = "${widget.value} operation with most errors" -# visualization = "facet_bar_chart" -# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `ops` LIMIT 10 EXTRAPOLATE" -# row = 2 + var.base_row + widget.key * (var.total_column_per_method / 3) -# column = 1 -# } -# } -# -# dynamic "widget" { -# for_each = var.event_methods -# -# content { -# title = "${widget.value} line with most errors" -# visualization = "facet_bar_chart" -# nrql = "SELECT count(*) FROM ${var.event_name} WHERE method ='${widget.value}' AND metric_status = 'error' or metric_status = 'expected_error' FACET `err_line` LIMIT 10 EXTRAPOLATE" -# row = 2 + var.base_row + widget.key * (var.total_column_per_method / 3) -# column = 2 -# width = 2 -# } -# } -#} diff --git a/variables.tf b/variables.tf index b051d1e..7d8f00e 100644 --- a/variables.tf +++ b/variables.tf @@ -22,16 +22,6 @@ variable "event_methods" { type = list(string) } -variable "base_row" { - type = number - default = 1 -} - -variable "total_column_per_method" { - type = number - default = 9 -} - variable "event_method_substring" { type = string } From 043910ed05735acc2d8784d03685f24b6db822c3 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 22:52:20 +0700 Subject: [PATCH 54/77] Fix Row --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index a48949a..f26040b 100644 --- a/main.tf +++ b/main.tf @@ -521,7 +521,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 1 + 1 + (widget_bar.key * 3) + row = 3 + 1 + (widget_bar.key * 5) column = 7 width = 6 @@ -555,7 +555,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 2 + 1 + (widget_bar.key * 3) + row = 4 + 1 + (widget_bar.key * 5) column = 7 width = 6 From 20c73a48066905426b5c7535797308962679a8e9 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 22:54:22 +0700 Subject: [PATCH 55/77] Fix Name --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index f26040b..47bff1c 100644 --- a/main.tf +++ b/main.tf @@ -279,7 +279,7 @@ resource "newrelic_one_dashboard" "main" { nrql_query { account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Pure Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } From 14fba78d57ffa4da5e041ed907109f08457a84ae Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 22:57:43 +0700 Subject: [PATCH 56/77] Attempt 2 --- main.tf | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/main.tf b/main.tf index 47bff1c..84f6c1d 100644 --- a/main.tf +++ b/main.tf @@ -196,7 +196,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + 1 + (widget_billboard.key * 3) + row = 2 + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -213,7 +213,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + 1 + (widget_billboard.key * 3) + row = 3 + (widget_billboard.key * 3) column = 1 + ((widget_billboard.key % 3) * 4) width = 1 height = 1 @@ -323,7 +323,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + 1 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 5) column = 1 width = 1 height = 1 @@ -340,7 +340,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + 1 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 5) column = 2 width = 1 height = 1 @@ -357,7 +357,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + 1 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 5) column = 3 width = 1 height = 1 @@ -374,7 +374,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + 1 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 5) column = 4 width = 1 height = 1 @@ -391,7 +391,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + 1 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 5) column = 1 width = 1 height = 1 @@ -411,7 +411,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + 1 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 5) column = 2 width = 1 height = 1 @@ -431,7 +431,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + 1 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 5) column = 3 width = 1 height = 1 @@ -451,7 +451,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + 1 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 5) column = 4 width = 1 height = 1 @@ -505,7 +505,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - row = 3 + 1 + (widget_bar.key * 5) + row = 2 + (widget_bar.key * 5) column = 1 width = 6 @@ -521,7 +521,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 3 + 1 + (widget_bar.key * 5) + row = 2 + (widget_bar.key * 5) column = 7 width = 6 @@ -539,7 +539,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - row = 4 + 1 + (widget_bar.key * 5) + row = 3 + (widget_bar.key * 5) column = 1 width = 6 @@ -555,7 +555,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 4 + 1 + (widget_bar.key * 5) + row = 3 + (widget_bar.key * 5) column = 7 width = 6 From 6b2dfbd9e56d85ef23710e5712be758c6197ae22 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 23:02:11 +0700 Subject: [PATCH 57/77] Attempt 3 --- main.tf | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/main.tf b/main.tf index 84f6c1d..06236fa 100644 --- a/main.tf +++ b/main.tf @@ -323,7 +323,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 5) column = 1 width = 1 height = 1 @@ -340,7 +340,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 5) column = 2 width = 1 height = 1 @@ -357,7 +357,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 5) column = 3 width = 1 height = 1 @@ -374,7 +374,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 5) column = 4 width = 1 height = 1 @@ -391,7 +391,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 5) column = 1 width = 1 height = 1 @@ -411,7 +411,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 5) column = 2 width = 1 height = 1 @@ -431,7 +431,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 5) column = 3 width = 1 height = 1 @@ -451,7 +451,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 5) column = 4 width = 1 height = 1 @@ -505,7 +505,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - row = 2 + (widget_bar.key * 5) + row = 2 + (widget_bar.key * 3) column = 1 width = 6 @@ -521,7 +521,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 2 + (widget_bar.key * 5) + row = 2 + (widget_bar.key * 3) column = 7 width = 6 @@ -539,7 +539,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - row = 3 + (widget_bar.key * 5) + row = 2 + (widget_bar.key * 3) column = 1 width = 6 @@ -555,7 +555,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 3 + (widget_bar.key * 5) + row = 2 + (widget_bar.key * 3) column = 7 width = 6 From 8118fb6e418448481f3e1d0a4d6d26c07afd4bbf Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 23:08:12 +0700 Subject: [PATCH 58/77] Attempt 4 --- main.tf | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/main.tf b/main.tf index 06236fa..5edcb6f 100644 --- a/main.tf +++ b/main.tf @@ -323,7 +323,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 5) column = 1 width = 1 height = 1 @@ -340,7 +340,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 5) column = 2 width = 1 height = 1 @@ -357,7 +357,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 5) column = 3 width = 1 height = 1 @@ -374,7 +374,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 5) column = 4 width = 1 height = 1 @@ -391,7 +391,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 5) column = 1 width = 1 height = 1 @@ -411,7 +411,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 5) column = 2 width = 1 height = 1 @@ -431,7 +431,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 5) column = 3 width = 1 height = 1 @@ -451,7 +451,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 5) column = 4 width = 1 height = 1 @@ -505,7 +505,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - row = 2 + (widget_bar.key * 3) + row = 4 + (widget_bar.key * 5) column = 1 width = 6 @@ -539,7 +539,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - row = 2 + (widget_bar.key * 3) + row = 5 + (widget_bar.key * 5) column = 1 width = 6 @@ -555,7 +555,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 2 + (widget_bar.key * 3) + row = 3 + (widget_bar.key * 3) column = 7 width = 6 From f43489d2fa98031f0c1e3c40b9e3e972e1d4269a Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 23:11:48 +0700 Subject: [PATCH 59/77] Attempt 5 --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 5edcb6f..335aa99 100644 --- a/main.tf +++ b/main.tf @@ -521,7 +521,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 2 + (widget_bar.key * 3) + row = 4 + (widget_bar.key * 5) column = 7 width = 6 @@ -555,7 +555,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 3 + (widget_bar.key * 3) + row = 5 + (widget_bar.key * 5) column = 7 width = 6 From da43a55d021df172de8afa26c3095093dad4149e Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 23:21:09 +0700 Subject: [PATCH 60/77] Attempt 6 --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 335aa99..5edcb6f 100644 --- a/main.tf +++ b/main.tf @@ -521,7 +521,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 4 + (widget_bar.key * 5) + row = 2 + (widget_bar.key * 3) column = 7 width = 6 @@ -555,7 +555,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 5 + (widget_bar.key * 5) + row = 3 + (widget_bar.key * 3) column = 7 width = 6 From 0fb2896ee3d58e6e59319a8e8645ab92bd5689ce Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 23:27:08 +0700 Subject: [PATCH 61/77] Attempt 7 --- main.tf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.tf b/main.tf index 5edcb6f..dca66d0 100644 --- a/main.tf +++ b/main.tf @@ -471,7 +471,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 1 + (widget_line.key * 3) + row = 1 + floor(widget_line.key / 3) column = 5 width = 4 @@ -482,12 +482,12 @@ resource "newrelic_one_dashboard" "main" { } } - dynamic "widget_bar" { + dynamic "widget_pie" { for_each = var.event_methods content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error code with most occurrence" - row = 1 + (widget_bar.key * 3) + title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" + row = 1 + floor(widget_pie.key / 3) column = 9 width = 4 @@ -521,7 +521,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 2 + (widget_bar.key * 3) + row = 3 + floor(widget_bar.key / 3) column = 7 width = 6 @@ -555,7 +555,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 3 + (widget_bar.key * 3) + row = 3 + floor(widget_bar.key / 3) column = 7 width = 6 From 76c38d031f5d827c06d9a5197f3bb68798b39f4f Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 23:28:56 +0700 Subject: [PATCH 62/77] Attempt 8 --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index dca66d0..b9d0b04 100644 --- a/main.tf +++ b/main.tf @@ -521,7 +521,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 3 + floor(widget_bar.key / 3) + row = 2 + floor(widget_bar.key / 3) column = 7 width = 6 From d5259244913e9ab68776e53a35e809bab34d6471 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 23:45:54 +0700 Subject: [PATCH 63/77] Attempt 9 --- main.tf | 88 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/main.tf b/main.tf index b9d0b04..721eca9 100644 --- a/main.tf +++ b/main.tf @@ -255,10 +255,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 4) column = 1 width = 1 - height = 1 + height = 2 nrql_query { account_id = var.account_id @@ -272,10 +272,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 4) column = 2 width = 1 - height = 1 + height = 2 nrql_query { account_id = var.account_id @@ -289,10 +289,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 4) column = 3 width = 1 - height = 1 + height = 2 nrql_query { account_id = var.account_id @@ -306,10 +306,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 4) column = 4 width = 1 - height = 1 + height = 2 nrql_query { account_id = var.account_id @@ -323,10 +323,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 4) column = 1 width = 1 - height = 1 + height = 2 nrql_query { account_id = var.account_id @@ -340,10 +340,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 4) column = 2 width = 1 - height = 1 + height = 2 nrql_query { account_id = var.account_id @@ -357,10 +357,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 4) column = 3 width = 1 - height = 1 + height = 2 nrql_query { account_id = var.account_id @@ -374,10 +374,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) + row = 2 + (widget_billboard.key * 4) column = 4 width = 1 - height = 1 + height = 2 nrql_query { account_id = var.account_id @@ -391,10 +391,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 4) column = 1 width = 1 - height = 1 + height = 2 warning = 1000 critical = 2000 @@ -411,10 +411,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 4) column = 2 width = 1 - height = 1 + height = 2 warning = 1000 critical = 2000 @@ -431,10 +431,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 4) column = 3 width = 1 - height = 1 + height = 2 warning = 1000 critical = 2000 @@ -451,10 +451,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) + row = 3 + (widget_billboard.key * 4) column = 4 width = 1 - height = 1 + height = 2 warning = 1000 critical = 2000 @@ -505,9 +505,9 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - row = 4 + (widget_bar.key * 5) - column = 1 - width = 6 + row = 2 + (widget_bar.key * 3) + column = 5 + width = 4 nrql_query { account_id = var.account_id @@ -521,9 +521,9 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 2 + floor(widget_bar.key / 3) - column = 7 - width = 6 + row = 2 + (widget_bar.key * 3) + column = 9 + width = 4 nrql_query { account_id = var.account_id @@ -534,14 +534,30 @@ resource "newrelic_one_dashboard" "main" { # 3 + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 4 + (widget_line.key * 4) + column = 1 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + } + } + } + dynamic "widget_bar" { for_each = var.event_methods content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - row = 5 + (widget_bar.key * 5) - column = 1 - width = 6 + row = 3 + (widget_bar.key * 3) + column = 5 + width = 4 nrql_query { account_id = var.account_id @@ -555,9 +571,9 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 3 + floor(widget_bar.key / 3) - column = 7 - width = 6 + row = 3 + (widget_bar.key * 3) + column = 9 + width = 4 nrql_query { account_id = var.account_id From c24f8c2ff15a4b57f2d927977a44443d72b5ccf5 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 13 Feb 2021 23:58:02 +0700 Subject: [PATCH 64/77] Attempt 10 --- main.tf | 154 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 94 insertions(+), 60 deletions(-) diff --git a/main.tf b/main.tf index 721eca9..5b3297f 100644 --- a/main.tf +++ b/main.tf @@ -203,7 +203,7 @@ resource "newrelic_one_dashboard" "main" { nrql_query { account_id = var.account_id - query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" + query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" } } } @@ -255,10 +255,78 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 4) + row = 1 + (widget_billboard.key * 5) + column = 1 + width = 2 + height = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 5) + column = 3 + width = 2 + height = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 1 + (widget_line.key * 3) + column = 5 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + } + } + } + + dynamic "widget_pie" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" + row = 1 + (widget_pie.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" + } + } + } + + # 2 + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 5) column = 1 width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id @@ -272,10 +340,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 4) + row = 2 + (widget_billboard.key * 5) column = 2 width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id @@ -289,10 +357,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 4) + row = 2 + (widget_billboard.key * 5) column = 3 width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id @@ -306,10 +374,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 4) + row = 2 + (widget_billboard.key * 5) column = 4 width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id @@ -323,10 +391,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 4) + row = 3 + (widget_billboard.key * 5) column = 1 width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id @@ -340,10 +408,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 4) + row = 3 + (widget_billboard.key * 5) column = 2 width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id @@ -357,10 +425,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 4) + row = 3 + (widget_billboard.key * 5) column = 3 width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id @@ -374,10 +442,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 4) + row = 3 + (widget_billboard.key * 5) column = 4 width = 1 - height = 2 + height = 1 nrql_query { account_id = var.account_id @@ -391,10 +459,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 4) + row = 4 + (widget_billboard.key * 5) column = 1 width = 1 - height = 2 + height = 1 warning = 1000 critical = 2000 @@ -411,10 +479,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 4) + row = 4 + (widget_billboard.key * 5) column = 2 width = 1 - height = 2 + height = 1 warning = 1000 critical = 2000 @@ -431,10 +499,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 4) + row = 4 + (widget_billboard.key * 5) column = 3 width = 1 - height = 2 + height = 1 warning = 1000 critical = 2000 @@ -451,10 +519,10 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 4) + row = 4 + (widget_billboard.key * 5) column = 4 width = 1 - height = 2 + height = 1 warning = 1000 critical = 2000 @@ -466,40 +534,6 @@ resource "newrelic_one_dashboard" "main" { } } - dynamic "widget_line" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 1 + floor(widget_line.key / 3) - column = 5 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" - } - } - } - - dynamic "widget_pie" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" - row = 1 + floor(widget_pie.key / 3) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" - } - } - } - - # 2 - dynamic "widget_bar" { for_each = var.event_methods @@ -539,7 +573,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 4 + (widget_line.key * 4) + row = 5 + (widget_line.key * 5) column = 1 width = 4 From 034fc2864556b208982c8cd9ce9a29f5ec15d501 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sun, 14 Feb 2021 00:06:06 +0700 Subject: [PATCH 65/77] Better README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b1e069..7beaa2b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ module "grpc_dashboard" { source = "git::https://github.com/rizalgowandy/terraform-peractio-newrelic?ref=v0.1.0" # Replace with your account id. - account_id = 123456 + account_id = var.account_id # Replace with your application id. application_id = data.newrelic_entity.app_grpc.application_id From 9bdc4908315d818a3c4646af22e7b0d727e06cb1 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 11:59:38 +0700 Subject: [PATCH 66/77] Comment Out --- main.tf | 742 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 371 insertions(+), 371 deletions(-) diff --git a/main.tf b/main.tf index 5b3297f..cf63023 100644 --- a/main.tf +++ b/main.tf @@ -245,375 +245,375 @@ resource "newrelic_one_dashboard" "main" { } } - page { - name = "Detail" - - # 1 - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) - column = 1 - width = 2 - height = 3 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) - column = 3 - width = 2 - height = 3 - - nrql_query { - account_id = var.account_id - query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_line" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 1 + (widget_line.key * 3) - column = 5 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" - } - } - } - - dynamic "widget_pie" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" - row = 1 + (widget_pie.key * 3) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" - } - } - } - - # 2 - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) - column = 1 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) - column = 2 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) - column = 3 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) - column = 4 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) - column = 1 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) - column = 2 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) - column = 3 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) - column = 4 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 4 + (widget_billboard.key * 5) - column = 1 - width = 1 - height = 1 - - warning = 1000 - critical = 2000 - - nrql_query { - account_id = var.account_id - query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 4 + (widget_billboard.key * 5) - column = 2 - width = 1 - height = 1 - - warning = 1000 - critical = 2000 - - nrql_query { - account_id = var.account_id - query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 4 + (widget_billboard.key * 5) - column = 3 - width = 1 - height = 1 - - warning = 1000 - critical = 2000 - - nrql_query { - account_id = var.account_id - query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 4 + (widget_billboard.key * 5) - column = 4 - width = 1 - height = 1 - - warning = 1000 - critical = 2000 - - nrql_query { - account_id = var.account_id - query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - row = 2 + (widget_bar.key * 3) - column = 5 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 2 + (widget_bar.key * 3) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" - } - } - } - - # 3 - - dynamic "widget_line" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 5 + (widget_line.key * 5) - column = 1 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - row = 3 + (widget_bar.key * 3) - column = 5 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 3 + (widget_bar.key * 3) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" - } - } - } - } + # page { + # name = "Detail" + # + # # 1 + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 1 + (widget_billboard.key * 5) + # column = 1 + # width = 2 + # height = 3 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 1 + (widget_billboard.key * 5) + # column = 3 + # width = 2 + # height = 3 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_line" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + # row = 1 + (widget_line.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + # } + # } + # } + # + # dynamic "widget_pie" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" + # row = 1 + (widget_pie.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # # 2 + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # # 3 + # + # dynamic "widget_line" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + # row = 5 + (widget_line.key * 5) + # column = 1 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # } } From 52c4caa8fd44fcb774118525cf7ab06ff7f46441 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 17:37:42 +0700 Subject: [PATCH 67/77] Add Detail 1 --- main.tf | 742 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 371 insertions(+), 371 deletions(-) diff --git a/main.tf b/main.tf index cf63023..c95fb37 100644 --- a/main.tf +++ b/main.tf @@ -245,375 +245,375 @@ resource "newrelic_one_dashboard" "main" { } } - # page { - # name = "Detail" - # - # # 1 - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 1 + (widget_billboard.key * 5) - # column = 1 - # width = 2 - # height = 3 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 1 + (widget_billboard.key * 5) - # column = 3 - # width = 2 - # height = 3 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_line" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - # row = 1 + (widget_line.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" - # } - # } - # } - # - # dynamic "widget_pie" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" - # row = 1 + (widget_pie.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # # 2 - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # # 3 - # - # dynamic "widget_line" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - # row = 5 + (widget_line.key * 5) - # column = 1 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # } + page { + name = "Detail" + + # 1 + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 5) + column = 1 + width = 2 + height = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 5) + column = 3 + width = 2 + height = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 1 + (widget_line.key * 3) + column = 5 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + } + } + } + + dynamic "widget_pie" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" + row = 1 + (widget_pie.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" + } + } + } + + # # 2 + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # # 3 + # + # dynamic "widget_line" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + # row = 5 + (widget_line.key * 5) + # column = 1 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + } } From e068bb49e8be39edb6170a5530ee6c9c8f5c892a Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 18:03:15 +0700 Subject: [PATCH 68/77] Add Detail 2 --- main.tf | 498 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 249 insertions(+), 249 deletions(-) diff --git a/main.tf b/main.tf index c95fb37..f63c3f5 100644 --- a/main.tf +++ b/main.tf @@ -316,255 +316,255 @@ resource "newrelic_one_dashboard" "main" { } } - # # 2 - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" - # } - # } - # } + # 2 + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 5) + column = 1 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 5) + column = 2 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 5) + column = 3 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 5) + column = 4 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 3 + (widget_billboard.key * 5) + column = 1 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 3 + (widget_billboard.key * 5) + column = 2 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 3 + (widget_billboard.key * 5) + column = 3 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 3 + (widget_billboard.key * 5) + column = 4 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 4 + (widget_billboard.key * 5) + column = 1 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 4 + (widget_billboard.key * 5) + column = 2 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 4 + (widget_billboard.key * 5) + column = 3 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 4 + (widget_billboard.key * 5) + column = 4 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" + row = 2 + (widget_bar.key * 3) + column = 5 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" + row = 2 + (widget_bar.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + } + } + } # # # 3 # From 4d430d4a5f4119251ea21bc304ee87fc7ddcb6e3 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 18:19:25 +0700 Subject: [PATCH 69/77] Add Detail 3 --- main.tf | 100 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/main.tf b/main.tf index f63c3f5..5b3297f 100644 --- a/main.tf +++ b/main.tf @@ -565,55 +565,55 @@ resource "newrelic_one_dashboard" "main" { } } } - # - # # 3 - # - # dynamic "widget_line" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - # row = 5 + (widget_line.key * 5) - # column = 1 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" - # } - # } - # } + + # 3 + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 5 + (widget_line.key * 5) + column = 1 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" + row = 3 + (widget_bar.key * 3) + column = 5 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" + row = 3 + (widget_bar.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + } + } + } } } From 257317eee5c89f743193a4801a14bc631c6a405e Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 18:30:58 +0700 Subject: [PATCH 70/77] Comment Out 2 --- main.tf | 494 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 247 insertions(+), 247 deletions(-) diff --git a/main.tf b/main.tf index 5b3297f..07109ec 100644 --- a/main.tf +++ b/main.tf @@ -318,253 +318,253 @@ resource "newrelic_one_dashboard" "main" { # 2 - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) - column = 1 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) - column = 2 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) - column = 3 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 2 + (widget_billboard.key * 5) - column = 4 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) - column = 1 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) - column = 2 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) - column = 3 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 3 + (widget_billboard.key * 5) - column = 4 - width = 1 - height = 1 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 4 + (widget_billboard.key * 5) - column = 1 - width = 1 - height = 1 - - warning = 1000 - critical = 2000 - - nrql_query { - account_id = var.account_id - query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 4 + (widget_billboard.key * 5) - column = 2 - width = 1 - height = 1 - - warning = 1000 - critical = 2000 - - nrql_query { - account_id = var.account_id - query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 4 + (widget_billboard.key * 5) - column = 3 - width = 1 - height = 1 - - warning = 1000 - critical = 2000 - - nrql_query { - account_id = var.account_id - query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 4 + (widget_billboard.key * 5) - column = 4 - width = 1 - height = 1 - - warning = 1000 - critical = 2000 - - nrql_query { - account_id = var.account_id - query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - row = 2 + (widget_bar.key * 3) - column = 5 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 2 + (widget_bar.key * 3) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" - } - } - } + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 2 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 3 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 1 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 2 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 3 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 4 + (widget_billboard.key * 5) + # column = 4 + # width = 1 + # height = 1 + # + # warning = 1000 + # critical = 2000 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + # } + # } + # } # 3 From c1e8b5dbfa757b716589ac4dea0c87f718f12014 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 18:47:10 +0700 Subject: [PATCH 71/77] Comment Out 3 --- main.tf | 98 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/main.tf b/main.tf index 07109ec..32991da 100644 --- a/main.tf +++ b/main.tf @@ -566,54 +566,54 @@ resource "newrelic_one_dashboard" "main" { # } # } - # 3 - - dynamic "widget_line" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 5 + (widget_line.key * 5) - column = 1 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - row = 3 + (widget_bar.key * 3) - column = 5 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 3 + (widget_bar.key * 3) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" - } - } - } + # # 3 + # + # dynamic "widget_line" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + # row = 5 + (widget_line.key * 5) + # column = 1 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + # } + # } + # } } } From f8e9b22c04c39c00c05ae14150e3c95b56391846 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 19:20:54 +0700 Subject: [PATCH 72/77] Add Statistic Page --- main.tf | 657 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 356 insertions(+), 301 deletions(-) diff --git a/main.tf b/main.tf index 32991da..a107d09 100644 --- a/main.tf +++ b/main.tf @@ -245,6 +245,276 @@ resource "newrelic_one_dashboard" "main" { } } + page { + name = "Statistic" + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 1) + column = 1 + width = 2 + height = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 1) + column = 3 + width = 2 + height = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 3) + column = 5 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 3) + column = 6 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 3) + column = 7 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 3) + column = 8 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 3) + column = 5 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 3) + column = 6 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 3) + column = 7 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 2 + (widget_billboard.key * 3) + column = 8 + width = 1 + height = 1 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 3 + (widget_billboard.key * 3) + column = 5 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 3 + (widget_billboard.key * 3) + column = 6 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 3 + (widget_billboard.key * 3) + column = 7 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 3 + (widget_billboard.key * 3) + column = 8 + width = 1 + height = 1 + + warning = 1000 + critical = 2000 + + nrql_query { + account_id = var.account_id + query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 1 + (widget_line.key * 1) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + } + } + } + } + page { name = "Detail" @@ -255,7 +525,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 3) column = 1 width = 2 height = 3 @@ -272,7 +542,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 5) + row = 1 + (widget_billboard.key * 3) column = 3 width = 2 height = 3 @@ -300,13 +570,32 @@ resource "newrelic_one_dashboard" "main" { } } + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 1 + (widget_line.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + } + } + } + + # 2 + dynamic "widget_pie" { for_each = var.event_methods content { title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" row = 1 + (widget_pie.key * 3) - column = 9 + column = 1 width = 4 nrql_query { @@ -316,304 +605,70 @@ resource "newrelic_one_dashboard" "main" { } } - # 2 + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" + row = 2 + (widget_bar.key * 3) + column = 5 + width = 4 - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success')) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('expected_error')) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 2 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success', 'expected_error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Real Success' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('success')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Expected Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('expected_error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 3 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Error' from ${var.event_name} WHERE method = '${widget_billboard.value}' AND metric_status IN ('error')" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 1 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT average(timer) as 'ms (avg)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 2 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentile(timer, 95) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 3 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentile(timer, 99) as ms FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 4 + (widget_billboard.key * 5) - # column = 4 - # width = 1 - # height = 1 - # - # warning = 1000 - # critical = 2000 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT max(timer) as 'ms (slowest)' FROM ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - - # # 3 - # - # dynamic "widget_line" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - # row = 5 + (widget_line.key * 5) - # column = 1 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" - # } - # } - # } + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" + row = 2 + (widget_bar.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + } + } + } + + # 3 + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" + row = 3 + (widget_bar.key * 3) + column = 1 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" + row = 3 + (widget_bar.key * 3) + column = 5 + width = 8 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + } + } + } } } From a3924d8a552bb6e155a82b86080a5d8d7c3921b1 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 19:22:04 +0700 Subject: [PATCH 73/77] Fix Row --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index a107d09..eaffa46 100644 --- a/main.tf +++ b/main.tf @@ -594,7 +594,7 @@ resource "newrelic_one_dashboard" "main" { content { title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" - row = 1 + (widget_pie.key * 3) + row = 2 + (widget_pie.key * 3) column = 1 width = 4 From 7670e868e0ede08a30afc69717f7193b408f8f55 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 19:26:58 +0700 Subject: [PATCH 74/77] Comment Out Detail --- main.tf | 312 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/main.tf b/main.tf index eaffa46..16d39c9 100644 --- a/main.tf +++ b/main.tf @@ -515,160 +515,160 @@ resource "newrelic_one_dashboard" "main" { } } - page { - name = "Detail" - - # 1 - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 3) - column = 1 - width = 2 - height = 3 - - nrql_query { - account_id = var.account_id - query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_billboard" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - row = 1 + (widget_billboard.key * 3) - column = 3 - width = 2 - height = 3 - - nrql_query { - account_id = var.account_id - query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - } - } - } - - dynamic "widget_line" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 1 + (widget_line.key * 3) - column = 5 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" - } - } - } - - - dynamic "widget_line" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 1 + (widget_line.key * 3) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" - } - } - } - - # 2 - - dynamic "widget_pie" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" - row = 2 + (widget_pie.key * 3) - column = 1 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - row = 2 + (widget_bar.key * 3) - column = 5 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - row = 2 + (widget_bar.key * 3) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" - } - } - } - - # 3 - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - row = 3 + (widget_bar.key * 3) - column = 1 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" - } - } - } - - dynamic "widget_bar" { - for_each = var.event_methods - - content { - title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - row = 3 + (widget_bar.key * 3) - column = 5 - width = 8 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" - } - } - } - } + # page { + # name = "Detail" + # + # # 1 + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 1 + (widget_billboard.key * 3) + # column = 1 + # width = 2 + # height = 3 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_billboard" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 1 + (widget_billboard.key * 3) + # column = 3 + # width = 2 + # height = 3 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } + # } + # } + # + # dynamic "widget_line" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + # row = 1 + (widget_line.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + # } + # } + # } + # + # + # dynamic "widget_line" { + # for_each = var.event_methods + # + # content { + # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + # row = 1 + (widget_line.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + # } + # } + # } + # + # # 2 + # + # dynamic "widget_pie" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" + # row = 2 + (widget_pie.key * 3) + # column = 1 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 5 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 9 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # # 3 + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 1 + # width = 4 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # + # dynamic "widget_bar" { + # for_each = var.event_methods + # + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 5 + # width = 8 + # + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + # } + # } + # } + # } } From e4da2ceed4887ad7611a9cc110b400f30731b3df Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 19:36:15 +0700 Subject: [PATCH 75/77] Move Around Statistic --- main.tf | 268 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 134 insertions(+), 134 deletions(-) diff --git a/main.tf b/main.tf index 16d39c9..064333d 100644 --- a/main.tf +++ b/main.tf @@ -282,13 +282,29 @@ resource "newrelic_one_dashboard" "main" { } } + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 1 + (widget_line.key * 1) + column = 5 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE method = '${widget_line.value}' FACET metric_status EXTRAPOLATE TIMESERIES" + } + } + } + dynamic "widget_billboard" { for_each = var.event_methods content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 1 + (widget_billboard.key * 3) - column = 5 + column = 9 width = 1 height = 1 @@ -305,7 +321,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 1 + (widget_billboard.key * 3) - column = 6 + column = 10 width = 1 height = 1 @@ -322,7 +338,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 1 + (widget_billboard.key * 3) - column = 7 + column = 11 width = 1 height = 1 @@ -339,7 +355,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 1 + (widget_billboard.key * 3) - column = 8 + column = 12 width = 1 height = 1 @@ -356,7 +372,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 2 + (widget_billboard.key * 3) - column = 5 + column = 9 width = 1 height = 1 @@ -373,7 +389,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 2 + (widget_billboard.key * 3) - column = 6 + column = 10 width = 1 height = 1 @@ -390,7 +406,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 2 + (widget_billboard.key * 3) - column = 7 + column = 11 width = 1 height = 1 @@ -407,7 +423,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 2 + (widget_billboard.key * 3) - column = 8 + column = 12 width = 1 height = 1 @@ -424,7 +440,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 3 + (widget_billboard.key * 3) - column = 5 + column = 9 width = 1 height = 1 @@ -444,7 +460,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 3 + (widget_billboard.key * 3) - column = 6 + column = 10 width = 1 height = 1 @@ -464,7 +480,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 3 + (widget_billboard.key * 3) - column = 7 + column = 11 width = 1 height = 1 @@ -484,7 +500,7 @@ resource "newrelic_one_dashboard" "main" { content { title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value row = 3 + (widget_billboard.key * 3) - column = 8 + column = 12 width = 1 height = 1 @@ -497,178 +513,162 @@ resource "newrelic_one_dashboard" "main" { } } } - - dynamic "widget_line" { - for_each = var.event_methods - - content { - title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - row = 1 + (widget_line.key * 1) - column = 9 - width = 4 - - nrql_query { - account_id = var.account_id - query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" - } - } - } } - # page { - # name = "Detail" + # page { + # name = "Detail" # - # # 1 + # # 1 # - # dynamic "widget_billboard" { - # for_each = var.event_methods + # dynamic "widget_billboard" { + # for_each = var.event_methods # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 1 + (widget_billboard.key * 3) - # column = 1 - # width = 2 - # height = 3 + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 1 + (widget_billboard.key * 3) + # column = 1 + # width = 2 + # height = 3 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # nrql_query { + # account_id = var.account_id + # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } # } # } - # } # - # dynamic "widget_billboard" { - # for_each = var.event_methods + # dynamic "widget_billboard" { + # for_each = var.event_methods # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 1 + (widget_billboard.key * 3) - # column = 3 - # width = 2 - # height = 3 + # content { + # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + # row = 1 + (widget_billboard.key * 3) + # column = 3 + # width = 2 + # height = 3 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # nrql_query { + # account_id = var.account_id + # query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + # } # } # } - # } # - # dynamic "widget_line" { - # for_each = var.event_methods + # dynamic "widget_line" { + # for_each = var.event_methods # - # content { - # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - # row = 1 + (widget_line.key * 3) - # column = 5 - # width = 4 + # content { + # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + # row = 1 + (widget_line.key * 3) + # column = 5 + # width = 4 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + # } # } # } - # } # # - # dynamic "widget_line" { - # for_each = var.event_methods + # dynamic "widget_line" { + # for_each = var.event_methods # - # content { - # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - # row = 1 + (widget_line.key * 3) - # column = 9 - # width = 4 + # content { + # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + # row = 1 + (widget_line.key * 3) + # column = 9 + # width = 4 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + # } # } # } - # } # - # # 2 + # # 2 # - # dynamic "widget_pie" { - # for_each = var.event_methods + # dynamic "widget_pie" { + # for_each = var.event_methods # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" - # row = 2 + (widget_pie.key * 3) - # column = 1 - # width = 4 + # content { + # title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" + # row = 2 + (widget_pie.key * 3) + # column = 1 + # width = 4 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" + # } # } # } - # } # - # dynamic "widget_bar" { - # for_each = var.event_methods + # dynamic "widget_bar" { + # for_each = var.event_methods # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 5 - # width = 4 + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 5 + # width = 4 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + # } # } # } - # } # - # dynamic "widget_bar" { - # for_each = var.event_methods + # dynamic "widget_bar" { + # for_each = var.event_methods # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 9 - # width = 4 + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" + # row = 2 + (widget_bar.key * 3) + # column = 9 + # width = 4 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + # } # } # } - # } # - # # 3 + # # 3 # - # dynamic "widget_bar" { - # for_each = var.event_methods + # dynamic "widget_bar" { + # for_each = var.event_methods # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 1 - # width = 4 + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 1 + # width = 4 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + # } # } # } - # } # - # dynamic "widget_bar" { - # for_each = var.event_methods + # dynamic "widget_bar" { + # for_each = var.event_methods # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 5 - # width = 8 + # content { + # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" + # row = 3 + (widget_bar.key * 3) + # column = 5 + # width = 8 # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + # nrql_query { + # account_id = var.account_id + # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + # } # } # } # } - # } } From b2a05c1a01d0a858b2e87cb80c5d6244e868c81c Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 19:39:03 +0700 Subject: [PATCH 76/77] Add Detail Page --- main.tf | 312 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/main.tf b/main.tf index 064333d..f168ba8 100644 --- a/main.tf +++ b/main.tf @@ -515,160 +515,160 @@ resource "newrelic_one_dashboard" "main" { } } - # page { - # name = "Detail" - # - # # 1 - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 1 + (widget_billboard.key * 3) - # column = 1 - # width = 2 - # height = 3 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_billboard" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value - # row = 1 + (widget_billboard.key * 3) - # column = 3 - # width = 2 - # height = 3 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" - # } - # } - # } - # - # dynamic "widget_line" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - # row = 1 + (widget_line.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" - # } - # } - # } - # - # - # dynamic "widget_line" { - # for_each = var.event_methods - # - # content { - # title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value - # row = 1 + (widget_line.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) as 'Attempt from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" - # } - # } - # } - # - # # 2 - # - # dynamic "widget_pie" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" - # row = 2 + (widget_pie.key * 3) - # column = 1 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 5 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" - # row = 2 + (widget_bar.key * 3) - # column = 9 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # # 3 - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 1 - # width = 4 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # - # dynamic "widget_bar" { - # for_each = var.event_methods - # - # content { - # title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" - # row = 3 + (widget_bar.key * 3) - # column = 5 - # width = 8 - # - # nrql_query { - # account_id = var.account_id - # query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" - # } - # } - # } - # } + page { + name = "Detail" + + # 1 + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 3) + column = 1 + width = 2 + height = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT percentage(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_billboard" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + row = 1 + (widget_billboard.key * 3) + column = 3 + width = 2 + height = 3 + + nrql_query { + account_id = var.account_id + query = "SELECT rate(count(*), 1 minute) as 'RPM' from ${var.event_name} WHERE method = '${widget_billboard.value}'" + } + } + } + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 1 + (widget_line.key * 3) + column = 5 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt', filter(count(*), WHERE metric_status IN ('success', 'expected_error')) as 'Success', filter(count(*), WHERE metric_status IN ('error')) as 'Error' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES" + } + } + } + + + dynamic "widget_line" { + for_each = var.event_methods + + content { + title = var.event_method_substring != "" ? replace(widget_line.value, var.event_method_substring, var.event_method_replace) : widget_line.value + row = 1 + (widget_line.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) as 'Attempt' from ${var.event_name} WHERE method = '${widget_line.value}' EXTRAPOLATE TIMESERIES COMPARE WITH 1 WEEK AGO" + } + } + } + + # 2 + + dynamic "widget_pie" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_pie.value, var.event_method_substring, var.event_method_replace) : widget_pie.value} - Error code with most occurrence" + row = 2 + (widget_pie.key * 3) + column = 1 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' FACET `code` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Error with most occurrence" + row = 2 + (widget_bar.key * 3) + column = 5 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Human error message with most occurrence" + row = 2 + (widget_bar.key * 3) + column = 9 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `message` LIMIT 10 EXTRAPOLATE" + } + } + } + + # 3 + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Operation with most errors" + row = 3 + (widget_bar.key * 3) + column = 1 + width = 4 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `ops` LIMIT 10 EXTRAPOLATE" + } + } + } + + dynamic "widget_bar" { + for_each = var.event_methods + + content { + title = "${var.event_method_substring != "" ? replace(widget_bar.value, var.event_method_substring, var.event_method_replace) : widget_bar.value} - Line with most errors" + row = 3 + (widget_bar.key * 3) + column = 5 + width = 8 + + nrql_query { + account_id = var.account_id + query = "SELECT count(*) FROM ${var.event_name} WHERE metric_status = 'error' AND method = '${widget_bar.value}' FACET `err_line` LIMIT 10 EXTRAPOLATE" + } + } + } + } } From f8ab08b01761b0bee8873c3f40915b5a799bbf60 Mon Sep 17 00:00:00 2001 From: Rizal Widyarta Gowandy Date: Sat, 20 Feb 2021 19:47:31 +0700 Subject: [PATCH 77/77] Better Name --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index f168ba8..20f6d25 100644 --- a/main.tf +++ b/main.tf @@ -252,7 +252,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + title = "Success Rate" row = 1 + (widget_billboard.key * 1) column = 1 width = 2 @@ -269,7 +269,7 @@ resource "newrelic_one_dashboard" "main" { for_each = var.event_methods content { - title = var.event_method_substring != "" ? replace(widget_billboard.value, var.event_method_substring, var.event_method_replace) : widget_billboard.value + title = "Request per minute" row = 1 + (widget_billboard.key * 1) column = 3 width = 2