diff --git a/.github/workflows/.editorconfig b/.editorconfig similarity index 100% rename from .github/workflows/.editorconfig rename to .editorconfig diff --git a/.github/pr-labeler.yml b/.github/configs/pr-labeler.yml similarity index 79% rename from .github/pr-labeler.yml rename to .github/configs/pr-labeler.yml index 66c75c0..e274d49 100644 --- a/.github/pr-labeler.yml +++ b/.github/configs/pr-labeler.yml @@ -1,4 +1,4 @@ enhancement: [ 'feature/*', 'feat/*', 'f_*', '*_f*', 'i_*', '*_i*' ] bug: [ 'fix/*', 'bug/*', 'b_*', '*_b*' ] -chore: [ 'chore/*', '*_c_*', 'c_*' ] +chore: [ 'chore/*', '*_chore_*', '*_c_*', 'c_*' ] documentation: [ 'documentation/*', 'doc/*', '*_d*', 'd_*', '*_doc*', 'doc_*' ] diff --git a/.github/release-drafter.yml b/.github/configs/release-drafter.yml similarity index 100% rename from .github/release-drafter.yml rename to .github/configs/release-drafter.yml diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 0000000..2fb6dc8 --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,17 @@ +name: Greetings + +on: + pull_request: + types: [ opened ] + issues: + types: [ opened ] + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: 'Hi, thank you for creating this issue' + pr-message: 'Hi, thank you for your contribution' diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 9cfeb91..c48bbae 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -9,6 +9,6 @@ jobs: steps: - uses: TimonVS/pr-labeler-action@v3 with: - configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value + configuration-path: .github/configs/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 9ca8f88..a83d6cf 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -12,5 +12,8 @@ jobs: steps: # Drafts your next Release notes as Pull Requests are merged into "main" - uses: release-drafter/release-drafter@v5 + with: + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + config-name: configs/release-drafter.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index fdb9a18..ef8189d 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ Terraform module to interact with NewRelic. ```hcl data "newrelic_entity" "app_grpc" { - name = "app_grpc" # Replace with your service name. + name = "app_grpc" domain = "APM" type = "APPLICATION" } @@ -15,13 +15,18 @@ data "newrelic_entity" "app_grpc" { module "grpc_dashboard" { source = "git::https://github.com/rizalgowandy/terraform-peractio-newrelic?ref=v0.0.2" - service_name = "app_grpc" # Replace with your service name. + service_name = "app_grpc" + + # Replace with your application id. application_id = data.newrelic_entity.app_grpc.application_id - event_name = "grpc_performance" + # Replace with your metric name. - event_methods = [ - "/inventory.v1.Inventory/GetProducts", # Replace with your metric method name. + event_name = "grpc_performance" + + # Replace with your metric method name. + event_methods = [ + "/inventory.v1.Inventory/GetProducts", "/inventory.v1.Inventory/CheckStocks", ] } diff --git a/main.tf b/main.tf index 38fc00b..bff084f 100644 --- a/main.tf +++ b/main.tf @@ -1,5 +1,5 @@ resource "newrelic_dashboard" "main" { - title = var.service_name + title = var.dashboard_name filter { event_types = [ @@ -64,44 +64,44 @@ resource "newrelic_dashboard" "main" { } widget { - title = "Operation with most errors" + 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 `ops` LIMIT 10 EXTRAPOLATE" + 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 with most occurrence" + 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 `err` LIMIT 10 EXTRAPOLATE" + 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 = "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" + 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 { - title = "Line with most errors" + 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 `err_line` LIMIT 10 EXTRAPOLATE" + 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 - width = 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" + 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 = 3 + column = 2 + width = 2 } ##################### @@ -152,9 +152,9 @@ resource "newrelic_dashboard" "main" { for_each = var.event_methods content { - title = "${widget.value} operation with most errors" + 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 `ops` LIMIT 10 EXTRAPOLATE" + 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 } @@ -164,9 +164,9 @@ resource "newrelic_dashboard" "main" { for_each = var.event_methods content { - title = "${widget.value} error with most occurrence" + 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 `err` LIMIT 10 EXTRAPOLATE" + 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 } @@ -176,9 +176,9 @@ resource "newrelic_dashboard" "main" { 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" + 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 } @@ -190,12 +190,11 @@ resource "newrelic_dashboard" "main" { for_each = var.event_methods content { - title = "${widget.value} line with most errors" + 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 `err_line` LIMIT 10 EXTRAPOLATE" + 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 - width = 2 } } @@ -203,11 +202,12 @@ resource "newrelic_dashboard" "main" { 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" + 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 = 3 + column = 2 + width = 2 } } } diff --git a/variables.tf b/variables.tf index 98edb64..85b785b 100644 --- a/variables.tf +++ b/variables.tf @@ -1,3 +1,7 @@ +variable "dashboard_name" { + type = string +} + variable "service_name" { type = string } diff --git a/versions.tf b/versions.tf index 0b41eed..006ed90 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = "~> 0.14.4" + required_version = "~> 0.14.5" required_providers { newrelic = {