From 210de39dc505d068d0cd484081bed48eb55fef6a Mon Sep 17 00:00:00 2001 From: Ignacio Perez Date: Tue, 29 Apr 2025 13:02:16 -0300 Subject: [PATCH 01/16] Add infra folder for new relic alerts --- infra/new_relic/Dockerfile | 0 infra/new_relic/alerts.tf | 134 +++++++++++++++++++++++++++++++ infra/new_relic/variables.tfvars | 4 + 3 files changed, 138 insertions(+) create mode 100644 infra/new_relic/Dockerfile create mode 100644 infra/new_relic/alerts.tf create mode 100644 infra/new_relic/variables.tfvars diff --git a/infra/new_relic/Dockerfile b/infra/new_relic/Dockerfile new file mode 100644 index 00000000..e69de29b diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf new file mode 100644 index 00000000..fafcc8e1 --- /dev/null +++ b/infra/new_relic/alerts.tf @@ -0,0 +1,134 @@ +variable "newrelic_account_id" { + type = string +} + +variable "newrelic_api_key" { + type = string +} + +variable "newrelic_region" { + type = string + default = "US" +} + +variable "app_name" { + type = string +} + +# TODO: +# Add names for different environments + +provider "newrelic" { + account_id = var.newrelic_account_id + api_key = var.newrelic_api_key + region = var.newrelic_region +} + +# Define your alert policy +resource "newrelic_alert_policy" "golden_metrics_policy" { + name = "Golden Metrics Alert Policy" +} + +# Error rate condition +resource "newrelic_nrql_alert_condition" "error_rate" { + policy_id = newrelic_alert_policy.golden_metrics_policy.id + name = "High Error Rate" + type = "static" + + nrql { + query = "FROM Transaction SELECT percentage(count(*), WHERE error IS true) AS 'error_rate' WHERE appName = '${var.app_name}'" + } + + terms { + threshold = 5 + threshold_duration = 300 + threshold_occurrences = "ALL" + operator = "above" + priority = "critical" + } + + signal { + aggregation_window = 60 + aggregation_method = "event_flow" + } + + enabled = true +} + +# Response time condition +resource "newrelic_nrql_alert_condition" "response_time" { + policy_id = newrelic_alert_policy.golden_metrics_policy.id + name = "High Response Time" + type = "static" + + nrql { + query = "FROM Transaction SELECT average(duration) WHERE appName = '${var.app_name}'" + } + + terms { + threshold = 1.5 + threshold_duration = 300 + threshold_occurrences = "ALL" + operator = "above" + priority = "critical" + } + + signal { + aggregation_window = 60 + aggregation_method = "event_flow" + } + + enabled = true +} + +# Throughput condition +resource "newrelic_nrql_alert_condition" "low_throughput" { + policy_id = newrelic_alert_policy.golden_metrics_policy.id + name = "Low Throughput" + type = "static" + + nrql { + query = "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = '${var.app_name}'" + } + + terms { + threshold = 1 + threshold_duration = 300 + threshold_occurrences = "ALL" + operator = "below" + priority = "warning" + } + + signal { + aggregation_window = 60 + aggregation_method = "event_flow" + } + + enabled = true +} + +# Apdex condition +resource "newrelic_nrql_alert_condition" "apdex" { + policy_id = newrelic_alert_policy.golden_metrics_policy.id + name = "Low Apdex Score" + type = "static" + + nrql { + query = "FROM Transaction SELECT apdex(duration, t:0.5) WHERE appName = '${var.app_name}'" + } + + terms { + threshold = 0.85 + threshold_duration = 300 + threshold_occurrences = "ALL" + operator = "below" + priority = "critical" + } + + signal { + aggregation_window = 60 + aggregation_method = "event_flow" + } + + enabled = true +} diff --git a/infra/new_relic/variables.tfvars b/infra/new_relic/variables.tfvars new file mode 100644 index 00000000..c64885a4 --- /dev/null +++ b/infra/new_relic/variables.tfvars @@ -0,0 +1,4 @@ +newrelic_account_id = "" +newrelic_api_key = "" +newrelic_region = "US" +app_name = "rails_api_base" From 328d4c4f93af3cb4cfe757b686fdbc154074acf6 Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Tue, 6 May 2025 13:00:49 -0300 Subject: [PATCH 02/16] WIP --- infra/new_relic/.gitignore | 1 + infra/new_relic/.terraform.lock.hcl | 27 ++++ infra/new_relic/Dockerfile | 16 ++ infra/new_relic/alerts.tf | 224 ++++++++++++++++++++-------- 4 files changed, 208 insertions(+), 60 deletions(-) create mode 100644 infra/new_relic/.gitignore create mode 100644 infra/new_relic/.terraform.lock.hcl diff --git a/infra/new_relic/.gitignore b/infra/new_relic/.gitignore new file mode 100644 index 00000000..3fa8c86b --- /dev/null +++ b/infra/new_relic/.gitignore @@ -0,0 +1 @@ +.terraform diff --git a/infra/new_relic/.terraform.lock.hcl b/infra/new_relic/.terraform.lock.hcl new file mode 100644 index 00000000..750b9902 --- /dev/null +++ b/infra/new_relic/.terraform.lock.hcl @@ -0,0 +1,27 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/newrelic/newrelic" { + version = "3.61.0" + hashes = [ + "h1:hvVjaulLrMGWjyJbFmlWoLFNO//espYTfUamuOWU5VY=", + "zh:0988ea702449dfe50f1a1d5b648a6d21e705ed96a79494526398e63a14b5cb49", + "zh:0fbf18f31ba85e3b6e440f19eb64e177811ffc833c68f99bf698a3285fe78d9f", + "zh:1b1d7e5dd63754604c6d4aa1494968bb9f74f594ad2a4e6391a170922ef5870f", + "zh:3daa7f87674f1159a020c1b15014990cab1a0331c0acc9b5cb4176c151ea5977", + "zh:55e18268e3f0233ac9905c65d8404708336edbead6d795c5e6481fd77d839788", + "zh:567a0204309a6de9d27ce2426ce498516604cfe947b923724a72b6f8b0c5c1c2", + "zh:5b56fdb5837e01e8701bf7888dd59a222b75a9926e05801054e0f5324a972276", + "zh:5d51077e392080cad2f981999c26ad62f242ed37b3fbedc0e57501b55c3e8b99", + "zh:7612219e2f9d62179b2b579d091f1c43c4aecfd0572d2be89cf9c762daf2d095", + "zh:7a7dcf55bfcc379ae0667a4181a90fdcbaef3cbf80b1f60d8770ecbdc99a5eee", + "zh:7e3565d8d4ed59f414d46c7beb05bdcdad307736fc77c9030af70e9c4658dbb0", + "zh:87f01c33ac82c6fea84aaae1c6aadb7f69931b3b10e7642f70442163e0bd0e3a", + "zh:8d8cfa78278ad5dcae90d5a16450e6cf73138028852647a33ecb9a2915aff483", + "zh:9cb4027e1099c70428e3b0cdd8c64e0316cf6967ef7e436c4fd45ed2cee46407", + "zh:ac0ba9be2fba2c61aac29b0ee8b766ce5f7ecbabd06ebcf558eb718d7a0f996e", + "zh:ced2c73d3d63a540bf7e4634996e9fa22e9c99dd13b87fe369d0da169c46fb3f", + "zh:df27dc9d839ee0279afca8c2594a72e301c639e7d18a0eaad81dda177bcf9289", + "zh:fbd1fee2c9df3aa19cf8851ce134dea6e45ea01cb85695c1726670c285797e25", + ] +} diff --git a/infra/new_relic/Dockerfile b/infra/new_relic/Dockerfile index e69de29b..5af18356 100644 --- a/infra/new_relic/Dockerfile +++ b/infra/new_relic/Dockerfile @@ -0,0 +1,16 @@ +FROM hashicorp/terraform:latest + + +RUN mkdir /app + +WORKDIR /app + +COPY alerts.tf variables.tfvars ./ + +# RUN terraform init + +# RUN terraform plan -out=plan.tfplan + +# RUN terraform apply plan.tfplan + +# ENTRYPOINT [ "/bin/bash" ] diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index fafcc8e1..08327cfd 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -13,122 +13,226 @@ variable "newrelic_region" { variable "app_name" { type = string + default = "rails_api_base" } # TODO: # Add names for different environments +terraform { + # Require Terraform version 1.0 (recommended) + required_version = "~> 1.0" + + # Require the latest 2.x version of the New Relic provider + required_providers { + newrelic = { + source = "newrelic/newrelic" + } + } +} + +# https://registry.terraform.io/providers/Newrelic/Newrelic/latest/docs/guides/migration_guide_alert_conditions provider "newrelic" { account_id = var.newrelic_account_id api_key = var.newrelic_api_key region = var.newrelic_region } +data "newrelic_entity" "rails_api_base" { + name = "rails_api_base" # Must be an exact match to your application name in New Relic + domain = "APM" # or BROWSER, INFRA, MOBILE, SYNTH, depending on your entity's domain + type = "APPLICATION" +} + # Define your alert policy resource "newrelic_alert_policy" "golden_metrics_policy" { name = "Golden Metrics Alert Policy" } -# Error rate condition -resource "newrelic_nrql_alert_condition" "error_rate" { - policy_id = newrelic_alert_policy.golden_metrics_policy.id - name = "High Error Rate" - type = "static" +resource "newrelic_alert_policy" "golden_signal_policy" { + name = "Golden Signals - ${data.newrelic_entity.rails_api_base.name}" +} + +# Response time - Create Alert Condition +resource "newrelic_nrql_alert_condition" "response_time_alert" { + policy_id = newrelic_alert_policy.golden_signal_policy.id + type = "static" + name = "Response Time - ${data.newrelic_entity.rails_api_base.name}" + description = "High Transaction Response Time" + # runbook_url = "https://www.example.com" + enabled = true + violation_time_limit_seconds = 3600 nrql { - query = "FROM Transaction SELECT percentage(count(*), WHERE error IS true) AS 'error_rate' WHERE appName = '${var.app_name}'" + query = "SELECT filter(average(newrelic.timeslice.value), WHERE metricTimesliceName = 'HttpDispatcher') OR 0 FROM Metric WHERE appId IN (${data.newrelic_entity.rails_api_base.application_id}) AND metricTimesliceName IN ('HttpDispatcher', 'Agent/MetricsReported/count')" } - terms { - threshold = 5 - threshold_duration = 300 + critical { + operator = "above" + threshold = 5 + threshold_duration = 300 threshold_occurrences = "ALL" - operator = "above" - priority = "critical" } - - signal { - aggregation_window = 60 - aggregation_method = "event_flow" - } - - enabled = true } -# Response time condition -resource "newrelic_nrql_alert_condition" "response_time" { +# Throughput condition +resource "newrelic_nrql_alert_condition" "low_throughput" { policy_id = newrelic_alert_policy.golden_metrics_policy.id - name = "High Response Time" - type = "static" + name = "Low Throughput" + type = "static" nrql { - query = "FROM Transaction SELECT average(duration) WHERE appName = '${var.app_name}'" + query = "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = '${var.app_name}'" } - terms { - threshold = 1.5 + critical { + threshold = 1 threshold_duration = 300 threshold_occurrences = "ALL" - operator = "above" - priority = "critical" + operator = "below" } - signal { - aggregation_window = 60 - aggregation_method = "event_flow" - } + # signal { + # aggregation_window = 60 + # aggregation_method = "event_flow" + # } enabled = true } -# Throughput condition -resource "newrelic_nrql_alert_condition" "low_throughput" { +# Error percentage +# Error rate condition +resource "newrelic_nrql_alert_condition" "error_rate" { policy_id = newrelic_alert_policy.golden_metrics_policy.id - name = "Low Throughput" + name = "High Error Rate" type = "static" nrql { - query = "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = '${var.app_name}'" + query = "FROM Transaction SELECT percentage(count(*), WHERE error IS true) AS 'error_rate' WHERE appName = '${var.app_name}'" } - terms { - threshold = 1 + critical { + threshold = 5 threshold_duration = 300 threshold_occurrences = "ALL" - operator = "below" - priority = "warning" + operator = "above" } - signal { - aggregation_window = 60 - aggregation_method = "event_flow" - } + # signal { + # aggregation_window = 60 + # aggregation_method = "event_flow" + # } enabled = true } -# Apdex condition -resource "newrelic_nrql_alert_condition" "apdex" { - policy_id = newrelic_alert_policy.golden_metrics_policy.id - name = "Low Apdex Score" - type = "static" +####################################### +# NOTIFICATIONS # +####################################### - nrql { - query = "FROM Transaction SELECT apdex(duration, t:0.5) WHERE appName = '${var.app_name}'" - } +resource "newrelic_notification_destination" "team_email_destination" { + name = "email-notification" + type = "EMAIL" - terms { - threshold = 0.85 - threshold_duration = 300 - threshold_occurrences = "ALL" - operator = "below" - priority = "critical" + property { + key = "email" + value = "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" } +} + +resource "newrelic_notification_channel" "team_email_channel" { + name = "email-example" + type = "EMAIL" + destination_id = newrelic_notification_destination.team_email_destination.id + product = "IINT" - signal { - aggregation_window = 60 - aggregation_method = "event_flow" + property { + key = "subject" + value = "New Alert" } +} +resource "newrelic_workflow" "team_workflow" { + name = "workflow-example" + enrichments_enabled = true + # destinations_enabled = true enabled = true + muting_rules_handling = "NOTIFY_ALL_ISSUES" + + enrichments { + nrql { + name = "Log" + configuration { + query = "SELECT count(*) FROM Metric" + } + } + } + + issues_filter { + name = "filter-example" + type = "FILTER" + + predicate { + attribute = "accumulations.sources" + operator = "EXACTLY_MATCHES" + values = [ "newrelic" ] + } + } + + destination { + channel_id = newrelic_notification_channel.team_email_channel.id + } } + + +# # Response time condition +# resource "newrelic_nrql_alert_condition" "response_time" { +# policy_id = newrelic_alert_policy.golden_metrics_policy.id +# name = "High Response Time" +# type = "static" + +# nrql { +# query = "FROM Transaction SELECT average(duration) WHERE appName = '${var.app_name}'" +# } + +# terms { +# threshold = 1.5 +# threshold_duration = 300 +# threshold_occurrences = "ALL" +# operator = "above" +# priority = "critical" +# } + +# signal { +# aggregation_window = 60 +# aggregation_method = "event_flow" +# } + +# enabled = true +# } + +# # Apdex condition +# resource "newrelic_nrql_alert_condition" "apdex" { +# policy_id = newrelic_alert_policy.golden_metrics_policy.id +# name = "Low Apdex Score" +# type = "static" + +# nrql { +# query = "FROM Transaction SELECT apdex(duration, t:0.5) WHERE appName = '${var.app_name}'" +# } + +# terms { +# threshold = 0.85 +# threshold_duration = 300 +# threshold_occurrences = "ALL" +# operator = "below" +# priority = "critical" +# } + +# signal { +# aggregation_window = 60 +# aggregation_method = "event_flow" +# } + +# enabled = true +# } From bbe798232f9c62bdbef0c535d3e30cb389b90bae Mon Sep 17 00:00:00 2001 From: Ignacio Perez Date: Tue, 13 May 2025 17:26:56 -0300 Subject: [PATCH 03/16] WIP 2 --- infra/new_relic/alerts.tf | 43 ++- infra/new_relic/terraform.tfstate | 404 ++++++++++++++++++++++ infra/new_relic/terraform.tfstate.backup | 420 +++++++++++++++++++++++ 3 files changed, 844 insertions(+), 23 deletions(-) create mode 100644 infra/new_relic/terraform.tfstate create mode 100644 infra/new_relic/terraform.tfstate.backup diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 08327cfd..42bccec1 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -1,9 +1,11 @@ variable "newrelic_account_id" { type = string + default = "" } variable "newrelic_api_key" { type = string + default = "" } variable "newrelic_region" { @@ -13,7 +15,7 @@ variable "newrelic_region" { variable "app_name" { type = string - default = "rails_api_base" + default = "rails_api_base - development" } # TODO: @@ -38,33 +40,28 @@ provider "newrelic" { region = var.newrelic_region } -data "newrelic_entity" "rails_api_base" { - name = "rails_api_base" # Must be an exact match to your application name in New Relic +data "newrelic_entity" "app" { + name = var.app_name # Must be an exact match to your application name in New Relic domain = "APM" # or BROWSER, INFRA, MOBILE, SYNTH, depending on your entity's domain type = "APPLICATION" } -# Define your alert policy resource "newrelic_alert_policy" "golden_metrics_policy" { - name = "Golden Metrics Alert Policy" -} - -resource "newrelic_alert_policy" "golden_signal_policy" { - name = "Golden Signals - ${data.newrelic_entity.rails_api_base.name}" + name = "Golden Signals - ${data.newrelic_entity.app.name}" } # Response time - Create Alert Condition resource "newrelic_nrql_alert_condition" "response_time_alert" { - policy_id = newrelic_alert_policy.golden_signal_policy.id + policy_id = newrelic_alert_policy.golden_metrics_policy.id type = "static" - name = "Response Time - ${data.newrelic_entity.rails_api_base.name}" + name = "Response Time - ${data.newrelic_entity.app.name}" description = "High Transaction Response Time" # runbook_url = "https://www.example.com" enabled = true violation_time_limit_seconds = 3600 nrql { - query = "SELECT filter(average(newrelic.timeslice.value), WHERE metricTimesliceName = 'HttpDispatcher') OR 0 FROM Metric WHERE appId IN (${data.newrelic_entity.rails_api_base.application_id}) AND metricTimesliceName IN ('HttpDispatcher', 'Agent/MetricsReported/count')" + query = "SELECT filter(average(newrelic.timeslice.value), WHERE metricTimesliceName = 'HttpDispatcher') OR 0 FROM Metric WHERE appId IN (${data.newrelic_entity.app.application_id}) AND metricTimesliceName IN ('HttpDispatcher', 'Agent/MetricsReported/count')" } critical { @@ -154,28 +151,28 @@ resource "newrelic_notification_channel" "team_email_channel" { resource "newrelic_workflow" "team_workflow" { name = "workflow-example" - enrichments_enabled = true + # enrichments_enabled = true # destinations_enabled = true enabled = true muting_rules_handling = "NOTIFY_ALL_ISSUES" - enrichments { - nrql { - name = "Log" - configuration { - query = "SELECT count(*) FROM Metric" - } - } - } + #enrichments { + # nrql { + # name = "Log" + # configuration { + # query = "SELECT count(*) FROM Metric" + # } + # } + # } issues_filter { name = "filter-example" type = "FILTER" predicate { - attribute = "accumulations.sources" + attribute = "accumulations.policyName" operator = "EXACTLY_MATCHES" - values = [ "newrelic" ] + values = [ newrelic_alert_policy.golden_metrics_policy.name ] } } diff --git a/infra/new_relic/terraform.tfstate b/infra/new_relic/terraform.tfstate new file mode 100644 index 00000000..b4f58126 --- /dev/null +++ b/infra/new_relic/terraform.tfstate @@ -0,0 +1,404 @@ +{ + "version": 4, + "terraform_version": "1.11.4", + "serial": 18, + "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "newrelic_entity", + "name": "app", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "application_id": 515583865, + "domain": "APM", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", + "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", + "ignore_case": false, + "ignore_not_found": false, + "name": "rails_api_base - development", + "serving_apm_application_id": null, + "tag": null, + "type": "APPLICATION" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_alert_policy", + "name": "golden_metrics_policy", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "channel_ids": null, + "id": "6244865", + "incident_preference": "PER_POLICY", + "name": "Golden Signals - rails_api_base - development" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "data.newrelic_entity.app" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_notification_channel", + "name": "team_email_channel", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "active": true, + "destination_id": "6b854383-0902-4581-a1c1-93446b807cb3", + "id": "e96ada53-aa67-42db-8d19-31084385e26e", + "name": "email-example", + "product": "IINT", + "property": [ + { + "display_value": "", + "key": "source", + "label": "terraform-source-internal", + "value": "terraform" + }, + { + "display_value": "", + "key": "subject", + "label": "", + "value": "New Alert" + } + ], + "status": "DEFAULT", + "timeouts": null, + "type": "EMAIL" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_notification_destination.team_email_destination" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_notification_destination", + "name": "team_email_destination", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "account_id": 6572468, + "active": true, + "auth_basic": [], + "auth_custom_header": [], + "auth_token": [], + "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnw2Yjg1NDM4My0wOTAyLTQ1ODEtYTFjMS05MzQ0NmI4MDdjYjM", + "id": "6b854383-0902-4581-a1c1-93446b807cb3", + "last_sent": "", + "name": "email-notification", + "property": [ + { + "display_value": "", + "key": "email", + "label": "", + "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" + }, + { + "display_value": "", + "key": "source", + "label": "terraform-source-internal", + "value": "terraform" + } + ], + "secure_url": [], + "status": "DEFAULT", + "timeouts": null, + "type": "EMAIL" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" + } + ] + }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "error_rate", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 5, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTIzNTE", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6244865:51792351", + "ignore_on_expected_termination": false, + "name": "High Error Rate", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "FROM Transaction SELECT percentage(count(*), WHERE error IS true) AS 'error_rate' WHERE appName = 'rails_api_base - development'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6244865, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "data.newrelic_entity.app", + "newrelic_alert_policy.golden_metrics_policy" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "low_throughput", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "below", + "prediction": [], + "threshold": 1, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTIzNTA", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6244865:51792350", + "ignore_on_expected_termination": false, + "name": "Low Throughput", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6244865, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "data.newrelic_entity.app", + "newrelic_alert_policy.golden_metrics_policy" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "response_time_alert", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 5, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "High Transaction Response Time", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTI1NTI", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6244865:51792552", + "ignore_on_expected_termination": false, + "name": "Response Time - rails_api_base - development", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT filter(average(newrelic.timeslice.value), WHERE metricTimesliceName = 'HttpDispatcher') OR 0 FROM Metric WHERE appId IN (515583865) AND metricTimesliceName IN ('HttpDispatcher', 'Agent/MetricsReported/count')", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6244865, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "ONE_HOUR", + "violation_time_limit_seconds": 3600, + "warning": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "data.newrelic_entity.app", + "newrelic_alert_policy.golden_metrics_policy" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_workflow", + "name": "team_workflow", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "account_id": 6572468, + "destination": [ + { + "channel_id": "e96ada53-aa67-42db-8d19-31084385e26e", + "name": "email-example", + "notification_triggers": [ + "ACKNOWLEDGED", + "ACTIVATED", + "CLOSED" + ], + "type": "EMAIL", + "update_original_message": true + } + ], + "destinations_enabled": true, + "enabled": true, + "enrichments": [], + "enrichments_enabled": true, + "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3wwZDhlYmZiZC1mZWY0LTRiZjgtYTg5My1lNTA5M2NlODQ3OWI", + "id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b", + "issues_filter": [ + { + "filter_id": "f9913086-029e-46a0-b465-3f1488eaa7dc", + "name": "filter-example", + "predicate": [ + { + "attribute": "accumulations.policyName", + "operator": "EXACTLY_MATCHES", + "values": [ + "Golden Signals - rails_api_base - development" + ] + } + ], + "type": "FILTER" + } + ], + "last_run": "", + "muting_rules_handling": "NOTIFY_ALL_ISSUES", + "name": "workflow-example", + "workflow_id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b" + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "data.newrelic_entity.app", + "newrelic_alert_policy.golden_metrics_policy", + "newrelic_notification_channel.team_email_channel", + "newrelic_notification_destination.team_email_destination" + ] + } + ] + } + ], + "check_results": null +} diff --git a/infra/new_relic/terraform.tfstate.backup b/infra/new_relic/terraform.tfstate.backup new file mode 100644 index 00000000..7aa6aca1 --- /dev/null +++ b/infra/new_relic/terraform.tfstate.backup @@ -0,0 +1,420 @@ +{ + "version": 4, + "terraform_version": "1.11.4", + "serial": 12, + "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", + "outputs": {}, + "resources": [ + { + "mode": "data", + "type": "newrelic_entity", + "name": "app", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "application_id": 515583865, + "domain": "APM", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", + "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", + "ignore_case": false, + "ignore_not_found": false, + "name": "rails_api_base - development", + "serving_apm_application_id": null, + "tag": null, + "type": "APPLICATION" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_alert_policy", + "name": "golden_metrics_policy", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "channel_ids": null, + "id": "6244865", + "incident_preference": "PER_POLICY", + "name": "Golden Metrics Alert Policy" + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, + { + "mode": "managed", + "type": "newrelic_alert_policy", + "name": "golden_signal_policy", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "channel_ids": null, + "id": "6244866", + "incident_preference": "PER_POLICY", + "name": "Golden Signals - rails_api_base - development" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "data.newrelic_entity.app" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_notification_channel", + "name": "team_email_channel", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "active": true, + "destination_id": "6b854383-0902-4581-a1c1-93446b807cb3", + "id": "e96ada53-aa67-42db-8d19-31084385e26e", + "name": "email-example", + "product": "IINT", + "property": [ + { + "display_value": "", + "key": "source", + "label": "terraform-source-internal", + "value": "terraform" + }, + { + "display_value": "", + "key": "subject", + "label": "", + "value": "New Alert" + } + ], + "status": "DEFAULT", + "timeouts": null, + "type": "EMAIL" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_notification_destination.team_email_destination" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_notification_destination", + "name": "team_email_destination", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "account_id": 6572468, + "active": true, + "auth_basic": [], + "auth_custom_header": [], + "auth_token": [], + "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnw2Yjg1NDM4My0wOTAyLTQ1ODEtYTFjMS05MzQ0NmI4MDdjYjM", + "id": "6b854383-0902-4581-a1c1-93446b807cb3", + "last_sent": "", + "name": "email-notification", + "property": [ + { + "display_value": "", + "key": "email", + "label": "", + "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" + }, + { + "display_value": "", + "key": "source", + "label": "terraform-source-internal", + "value": "terraform" + } + ], + "secure_url": [], + "status": "DEFAULT", + "timeouts": null, + "type": "EMAIL" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" + } + ] + }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "error_rate", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 5, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTIzNTE", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6244865:51792351", + "ignore_on_expected_termination": false, + "name": "High Error Rate", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "FROM Transaction SELECT percentage(count(*), WHERE error IS true) AS 'error_rate' WHERE appName = 'rails_api_base - development'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6244865, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "low_throughput", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "below", + "prediction": [], + "threshold": 1, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTIzNTA", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6244865:51792350", + "ignore_on_expected_termination": false, + "name": "Low Throughput", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6244865, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "response_time_alert", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 5, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "High Transaction Response Time", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTIzNTI", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6244866:51792352", + "ignore_on_expected_termination": false, + "name": "Response Time - rails_api_base - development", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT filter(average(newrelic.timeslice.value), WHERE metricTimesliceName = 'HttpDispatcher') OR 0 FROM Metric WHERE appId IN (515583865) AND metricTimesliceName IN ('HttpDispatcher', 'Agent/MetricsReported/count')", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6244866, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "ONE_HOUR", + "violation_time_limit_seconds": 3600, + "warning": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "data.newrelic_entity.app", + "newrelic_alert_policy.golden_signal_policy" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_workflow", + "name": "team_workflow", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 1, + "attributes": { + "account_id": 6572468, + "destination": [ + { + "channel_id": "e96ada53-aa67-42db-8d19-31084385e26e", + "name": "email-example", + "notification_triggers": [ + "ACKNOWLEDGED", + "ACTIVATED", + "CLOSED" + ], + "type": "EMAIL", + "update_original_message": true + } + ], + "destinations_enabled": true, + "enabled": true, + "enrichments": [], + "enrichments_enabled": true, + "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3wwZDhlYmZiZC1mZWY0LTRiZjgtYTg5My1lNTA5M2NlODQ3OWI", + "id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b", + "issues_filter": [ + { + "filter_id": "f9913086-029e-46a0-b465-3f1488eaa7dc", + "name": "filter-example", + "predicate": [ + { + "attribute": "accumulations.sources", + "operator": "EXACTLY_MATCHES", + "values": [ + "newrelic" + ] + } + ], + "type": "FILTER" + } + ], + "last_run": "", + "muting_rules_handling": "NOTIFY_ALL_ISSUES", + "name": "workflow-example", + "workflow_id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b" + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "newrelic_notification_channel.team_email_channel", + "newrelic_notification_destination.team_email_destination" + ] + } + ] + } + ], + "check_results": null +} From 93b7be8a48a87b3179aa4c9865f2d7ff6215923c Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Tue, 20 May 2025 16:09:11 -0300 Subject: [PATCH 04/16] WIP --- app/admin/user.rb | 6 ++ config/newrelic.yml | 4 +- infra/new_relic/alerts.tf | 17 +--- infra/new_relic/terraform.tfstate | 8 +- infra/new_relic/terraform.tfstate.backup | 111 +++++++++++++++++------ 5 files changed, 96 insertions(+), 50 deletions(-) diff --git a/app/admin/user.rb b/app/admin/user.rb index 9778d093..7451f9a0 100644 --- a/app/admin/user.rb +++ b/app/admin/user.rb @@ -69,4 +69,10 @@ target: '_blank', rel: 'noopener' end end + + controller do + def index + raise 'test' + end + end end diff --git a/config/newrelic.yml b/config/newrelic.yml index f8f8f6c4..a7fd2184 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -11,7 +11,7 @@ common: &default_settings # Required license key associated with your New Relic account. - license_key: <%= ENV['NEW_RELIC_API_KEY'] %> + license_key: <%= ENV['NEW_RELIC_LICENSE_KEY'] %> # Your application name. Renaming here affects where data displays in New # Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications @@ -30,7 +30,7 @@ common: &default_settings development: <<: *default_settings # Do not track the development environment by default. - monitor_mode: false + monitor_mode: true test: <<: *default_settings diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 42bccec1..51703c2c 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -97,7 +97,6 @@ resource "newrelic_nrql_alert_condition" "low_throughput" { enabled = true } -# Error percentage # Error rate condition resource "newrelic_nrql_alert_condition" "error_rate" { policy_id = newrelic_alert_policy.golden_metrics_policy.id @@ -110,7 +109,7 @@ resource "newrelic_nrql_alert_condition" "error_rate" { critical { threshold = 5 - threshold_duration = 300 + threshold_duration = 60 threshold_occurrences = "ALL" operator = "above" } @@ -123,6 +122,8 @@ resource "newrelic_nrql_alert_condition" "error_rate" { enabled = true } +# TODO: Add newrelic_workload and setup error inbox notification + ####################################### # NOTIFICATIONS # ####################################### @@ -151,20 +152,9 @@ resource "newrelic_notification_channel" "team_email_channel" { resource "newrelic_workflow" "team_workflow" { name = "workflow-example" - # enrichments_enabled = true - # destinations_enabled = true enabled = true muting_rules_handling = "NOTIFY_ALL_ISSUES" - #enrichments { - # nrql { - # name = "Log" - # configuration { - # query = "SELECT count(*) FROM Metric" - # } - # } - # } - issues_filter { name = "filter-example" type = "FILTER" @@ -181,7 +171,6 @@ resource "newrelic_workflow" "team_workflow" { } } - # # Response time condition # resource "newrelic_nrql_alert_condition" "response_time" { # policy_id = newrelic_alert_policy.golden_metrics_policy.id diff --git a/infra/new_relic/terraform.tfstate b/infra/new_relic/terraform.tfstate index b4f58126..a5635f71 100644 --- a/infra/new_relic/terraform.tfstate +++ b/infra/new_relic/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.11.4", - "serial": 18, + "serial": 32, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -17,7 +17,7 @@ "account_id": 6572468, "application_id": 515583865, "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"osRuntime\",\"values\":[\"docker\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", "ignore_case": false, @@ -159,7 +159,7 @@ "operator": "above", "prediction": [], "threshold": 5, - "threshold_duration": 300, + "threshold_duration": 60, "threshold_occurrences": "all", "time_function": "" } @@ -383,7 +383,7 @@ "type": "FILTER" } ], - "last_run": "", + "last_run": "2025-05-20T18:32:12.905Z", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "workflow-example", "workflow_id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b" diff --git a/infra/new_relic/terraform.tfstate.backup b/infra/new_relic/terraform.tfstate.backup index 7aa6aca1..79ffabcf 100644 --- a/infra/new_relic/terraform.tfstate.backup +++ b/infra/new_relic/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.11.4", - "serial": 12, + "serial": 29, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -17,7 +17,7 @@ "account_id": 6572468, "application_id": 515583865, "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"osRuntime\",\"values\":[\"docker\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", "ignore_case": false, @@ -44,26 +44,6 @@ "channel_ids": null, "id": "6244865", "incident_preference": "PER_POLICY", - "name": "Golden Metrics Alert Policy" - }, - "sensitive_attributes": [], - "private": "bnVsbA==" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_alert_policy", - "name": "golden_signal_policy", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6244866", - "incident_preference": "PER_POLICY", "name": "Golden Signals - rails_api_base - development" }, "sensitive_attributes": [], @@ -179,7 +159,7 @@ "operator": "above", "prediction": [], "threshold": 5, - "threshold_duration": 300, + "threshold_duration": 60, "threshold_occurrences": "all", "time_function": "" } @@ -218,6 +198,74 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ + "data.newrelic_entity.app", + "newrelic_alert_policy.golden_metrics_policy" + ] + } + ] + }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "exceptions", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 1, + "threshold_duration": 60, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE5NzUwOTU", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6244865:51975095", + "ignore_on_expected_termination": false, + "name": "Exceptions Detected", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "FROM TransactionError SELECT count(*), latest(message) as 'Error Message', latest(error.class) as 'Error Class', latest(transactionName) as 'Transaction', latest(request.uri) as 'URI' WHERE appName = 'rails_api_base - development'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6244865, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "data.newrelic_entity.app", "newrelic_alert_policy.golden_metrics_policy" ] } @@ -284,6 +332,7 @@ "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ + "data.newrelic_entity.app", "newrelic_alert_policy.golden_metrics_policy" ] } @@ -318,12 +367,12 @@ ], "description": "High Transaction Response Time", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTIzNTI", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTI1NTI", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6244866:51792352", + "id": "6244865:51792552", "ignore_on_expected_termination": false, "name": "Response Time - rails_api_base - development", "nrql": [ @@ -335,7 +384,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6244866, + "policy_id": 6244865, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -351,7 +400,7 @@ "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ "data.newrelic_entity.app", - "newrelic_alert_policy.golden_signal_policy" + "newrelic_alert_policy.golden_metrics_policy" ] } ] @@ -391,17 +440,17 @@ "name": "filter-example", "predicate": [ { - "attribute": "accumulations.sources", + "attribute": "accumulations.policyName", "operator": "EXACTLY_MATCHES", "values": [ - "newrelic" + "Golden Signals - rails_api_base - development" ] } ], "type": "FILTER" } ], - "last_run": "", + "last_run": "2025-05-20T18:32:12.905Z", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "workflow-example", "workflow_id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b" @@ -409,6 +458,8 @@ "sensitive_attributes": [], "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", "dependencies": [ + "data.newrelic_entity.app", + "newrelic_alert_policy.golden_metrics_policy", "newrelic_notification_channel.team_email_channel", "newrelic_notification_destination.team_email_destination" ] From 6c70094426363831611aa228d8c2c43144c6de8a Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Thu, 29 May 2025 14:57:41 -0300 Subject: [PATCH 05/16] WIP --- infra/new_relic/.env.sample | 10 + infra/new_relic/.gitignore | 1 + infra/new_relic/README.md | 15 + infra/new_relic/alerts.tf | 292 ++++++++++------- infra/new_relic/terraform.tfstate | 401 +---------------------- infra/new_relic/terraform.tfstate.backup | 81 +---- 6 files changed, 209 insertions(+), 591 deletions(-) create mode 100644 infra/new_relic/.env.sample create mode 100644 infra/new_relic/README.md diff --git a/infra/new_relic/.env.sample b/infra/new_relic/.env.sample new file mode 100644 index 00000000..372a2255 --- /dev/null +++ b/infra/new_relic/.env.sample @@ -0,0 +1,10 @@ +NEW_RELIC_ACCOUNT_ID=1234 +NEW_RELIC_API_KEY=NRAK-** +NEW_RELIC_REGION=US + +TF_VAR_app_name='["rails_api_base - development"]' + +TF_VAR_endpoints='["/api/v1/users", "/api/v1/orders"]' +# Map of endpoint-specific P95 thresholds (in seconds) to override. +# Not needed if you're ok with the default of 60 seconds. +TF_VAR_endpoint_thresholds='{ "/api/v1/orders": 2.0 }' diff --git a/infra/new_relic/.gitignore b/infra/new_relic/.gitignore index 3fa8c86b..c6550aa8 100644 --- a/infra/new_relic/.gitignore +++ b/infra/new_relic/.gitignore @@ -1 +1,2 @@ .terraform +.env diff --git a/infra/new_relic/README.md b/infra/new_relic/README.md new file mode 100644 index 00000000..0d38f2d5 --- /dev/null +++ b/infra/new_relic/README.md @@ -0,0 +1,15 @@ +## Docker usage + +```bash +# Build container +docker build -t new-relic-tf . + +# Run init command +docker run -v .:/app --env-file .env -it new-relic-tf init + +# Run plan command to verify what is going to change +docker run -v .:/app --env-file .env -it new-relic-tf plan + +# Apply plan +docker run -v .:/app --env-file .env -it new-relic-tf apply +``` \ No newline at end of file diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 51703c2c..81715911 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -1,67 +1,75 @@ -variable "newrelic_account_id" { - type = string - default = "" -} - -variable "newrelic_api_key" { - type = string - default = "" -} - -variable "newrelic_region" { - type = string - default = "US" -} - -variable "app_name" { - type = string - default = "rails_api_base - development" -} - -# TODO: -# Add names for different environments - terraform { - # Require Terraform version 1.0 (recommended) required_version = "~> 1.0" - # Require the latest 2.x version of the New Relic provider required_providers { newrelic = { source = "newrelic/newrelic" + version = "~> 3.0" } } } -# https://registry.terraform.io/providers/Newrelic/Newrelic/latest/docs/guides/migration_guide_alert_conditions -provider "newrelic" { - account_id = var.newrelic_account_id - api_key = var.newrelic_api_key - region = var.newrelic_region +# We use env variables to configure the provider +provider "newrelic" {} + +# Must be an exact match to your application name in New Relic +variable "app_name" { + type = list(string) + description = "List of New Relic application names." + default = [ + "rails_api_base - development" + ] +} + +# List of endpoints to monitor for latency +variable "endpoints" { + type = list(string) + description = "List of endpoint URIs to create P95 alert conditions for." + default = [] +} + +# Map of endpoint-specific thresholds (in seconds) +variable "endpoint_thresholds" { + type = map(object({ + p90 = optional(number) + p95 = optional(number) + })) + description = "Map of endpoint URIs to custom P90/P95 thresholds. If not set, uses default threshold." + default = { + "/api/v1/orders" = { p90 = 2.0, p95 = 3.0 } + "/api/v1/users" = { p90 = 1.5 } # Only override P90, use default for P95 + } } data "newrelic_entity" "app" { - name = var.app_name # Must be an exact match to your application name in New Relic - domain = "APM" # or BROWSER, INFRA, MOBILE, SYNTH, depending on your entity's domain - type = "APPLICATION" + for_each = toset(var.app_name) + name = each.value + domain = "APM" + type = "APPLICATION" } resource "newrelic_alert_policy" "golden_metrics_policy" { - name = "Golden Signals - ${data.newrelic_entity.app.name}" + for_each = toset(var.app_name) + name = "Golden Signals - ${each.value}" +} + +resource "newrelic_alert_policy" "percentiles_policy" { + for_each = toset(var.app_name) + name = "Percentiles - ${each.value}" } # Response time - Create Alert Condition resource "newrelic_nrql_alert_condition" "response_time_alert" { - policy_id = newrelic_alert_policy.golden_metrics_policy.id + for_each = toset(var.app_name) + policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id type = "static" - name = "Response Time - ${data.newrelic_entity.app.name}" + name = "Response Time - ${each.value}" description = "High Transaction Response Time" - # runbook_url = "https://www.example.com" enabled = true - violation_time_limit_seconds = 3600 + violation_time_limit_seconds = 259200 # 3 days nrql { - query = "SELECT filter(average(newrelic.timeslice.value), WHERE metricTimesliceName = 'HttpDispatcher') OR 0 FROM Metric WHERE appId IN (${data.newrelic_entity.app.application_id}) AND metricTimesliceName IN ('HttpDispatcher', 'Agent/MetricsReported/count')" + query = "SELECT average(duration) FROM Transaction WHERE appName = '${each.value}'" } critical { @@ -74,37 +82,38 @@ resource "newrelic_nrql_alert_condition" "response_time_alert" { # Throughput condition resource "newrelic_nrql_alert_condition" "low_throughput" { - policy_id = newrelic_alert_policy.golden_metrics_policy.id - name = "Low Throughput" + for_each = toset(var.app_name) + policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id type = "static" + name = "Low Throughput - ${each.value}" + description = "Low Throughput" + enabled = true + violation_time_limit_seconds = 259200 # 3 days nrql { - query = "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = '${var.app_name}'" + query = "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = '${each.value}'" } critical { - threshold = 1 + threshold = 5 threshold_duration = 300 threshold_occurrences = "ALL" operator = "below" } - - # signal { - # aggregation_window = 60 - # aggregation_method = "event_flow" - # } - - enabled = true } # Error rate condition resource "newrelic_nrql_alert_condition" "error_rate" { - policy_id = newrelic_alert_policy.golden_metrics_policy.id - name = "High Error Rate" - type = "static" + for_each = toset(var.app_name) + policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id + type = "static" + name = "High Error Rate - ${each.value}" + description = "High Error Rate" + enabled = true + violation_time_limit_seconds = 259200 # 3 days nrql { - query = "FROM Transaction SELECT percentage(count(*), WHERE error IS true) AS 'error_rate' WHERE appName = '${var.app_name}'" + query = "SELECT (filter(count(*), WHERE error IS true) / count(*)) * 100 AS 'error_rate' FROM Transaction WHERE appName = '${each.value}'" } critical { @@ -113,23 +122,107 @@ resource "newrelic_nrql_alert_condition" "error_rate" { threshold_occurrences = "ALL" operator = "above" } +} + +####################################### +# P90 and P95 Alerts # +####################################### + +# Global P90 Alert +resource "newrelic_nrql_alert_condition" "p90_alert" { + for_each = toset(var.app_name) + policy_id = newrelic_alert_policy.percentiles_policy[each.value].id + type = "static" + name = "P90 Alert - ${each.value}" + description = "P90 Alert" + enabled = true + violation_time_limit_seconds = 259200 # 3 days + + nrql { + query = "SELECT percentile(duration, 90) FROM Transaction WHERE appName = '${each.value}'" + } + + critical { + threshold = 1.5 # Recommended starting value, see below + threshold_duration = 60 + threshold_occurrences = "ALL" + operator = "above" + } +} + +# Global P95 Alert +resource "newrelic_nrql_alert_condition" "p95_alert" { + for_each = toset(var.app_name) + policy_id = newrelic_alert_policy.percentiles_policy[each.value].id + type = "static" + name = "P95 Alert - ${each.value}" + description = "P95 Alert" + enabled = true + violation_time_limit_seconds = 259200 # 3 days + + nrql { + query = "SELECT percentile(duration, 95) FROM Transaction WHERE appName = '${each.value}'" + } - # signal { - # aggregation_window = 60 - # aggregation_method = "event_flow" - # } + critical { + threshold = 5 + threshold_duration = 60 + threshold_occurrences = "ALL" + operator = "above" + } +} +# Per-endpoint P90 Alert +resource "newrelic_nrql_alert_condition" "endpoint_p90" { + for_each = { for pair in flatten([for app in var.app_name : [for endpoint in var.endpoints : { app = app, endpoint = endpoint }]]) : "${pair.app}|${pair.endpoint}" => pair } + policy_id = newrelic_alert_policy.percentiles_policy[each.value.app].id + type = "static" + name = "P90 Alert - ${each.value.app} - ${each.value.endpoint}" + description = "P90 Alert for endpoint ${each.value.endpoint}" enabled = true + violation_time_limit_seconds = 259200 # 3 days + + nrql { + query = "SELECT percentile(duration, 90) FROM Transaction WHERE appName = '${each.value.app}' AND request.uri = '${each.value.endpoint}'" + } + + critical { + threshold = lookup(try(var.endpoint_thresholds[each.value.endpoint].p90, null), each.value.endpoint, 1.5) + threshold_duration = 60 + threshold_occurrences = "ALL" + operator = "above" + } } -# TODO: Add newrelic_workload and setup error inbox notification +# Per-endpoint P95 Alert +resource "newrelic_nrql_alert_condition" "endpoint_p95" { + for_each = { for pair in flatten([for app in var.app_name : [for endpoint in var.endpoints : { app = app, endpoint = endpoint }]]) : "${pair.app}|${pair.endpoint}" => pair } + policy_id = newrelic_alert_policy.percentiles_policy[each.value.app].id + type = "static" + name = "P95 Alert - ${each.value.app} - ${each.value.endpoint}" + description = "P95 Alert for endpoint ${each.value.endpoint}" + enabled = true + violation_time_limit_seconds = 259200 # 3 days + + nrql { + query = "SELECT percentile(duration, 95) FROM Transaction WHERE appName = '${each.value.app}' AND request.uri = '${each.value.endpoint}'" + } + + critical { + threshold = lookup(try(var.endpoint_thresholds[each.value.endpoint].p95, null), each.value.endpoint, 2.5) + threshold_duration = 60 + threshold_occurrences = "ALL" + operator = "above" + } +} ####################################### # NOTIFICATIONS # ####################################### -resource "newrelic_notification_destination" "team_email_destination" { - name = "email-notification" +resource "newrelic_notification_destination" "email_destination" { + for_each = toset(var.app_name) + name = "Email destination - ${each.value}" type = "EMAIL" property { @@ -138,10 +231,11 @@ resource "newrelic_notification_destination" "team_email_destination" { } } -resource "newrelic_notification_channel" "team_email_channel" { - name = "email-example" +resource "newrelic_notification_channel" "email_channel" { + for_each = toset(var.app_name) + name = "Email channel - ${each.value}" type = "EMAIL" - destination_id = newrelic_notification_destination.team_email_destination.id + destination_id = newrelic_notification_destination.email_destination[each.value].id product = "IINT" property { @@ -150,75 +244,27 @@ resource "newrelic_notification_channel" "team_email_channel" { } } -resource "newrelic_workflow" "team_workflow" { - name = "workflow-example" +resource "newrelic_workflow" "workflow" { + for_each = toset(var.app_name) + name = "Workflow - ${each.value}" enabled = true muting_rules_handling = "NOTIFY_ALL_ISSUES" issues_filter { - name = "filter-example" + name = "Filter - ${each.value}" type = "FILTER" predicate { attribute = "accumulations.policyName" operator = "EXACTLY_MATCHES" - values = [ newrelic_alert_policy.golden_metrics_policy.name ] + values = [ + newrelic_alert_policy.golden_metrics_policy[each.value].name, + newrelic_alert_policy.percentiles_policy[each.value].name + ] } } destination { - channel_id = newrelic_notification_channel.team_email_channel.id - } -} - -# # Response time condition -# resource "newrelic_nrql_alert_condition" "response_time" { -# policy_id = newrelic_alert_policy.golden_metrics_policy.id -# name = "High Response Time" -# type = "static" - -# nrql { -# query = "FROM Transaction SELECT average(duration) WHERE appName = '${var.app_name}'" -# } - -# terms { -# threshold = 1.5 -# threshold_duration = 300 -# threshold_occurrences = "ALL" -# operator = "above" -# priority = "critical" -# } - -# signal { -# aggregation_window = 60 -# aggregation_method = "event_flow" -# } - -# enabled = true -# } - -# # Apdex condition -# resource "newrelic_nrql_alert_condition" "apdex" { -# policy_id = newrelic_alert_policy.golden_metrics_policy.id -# name = "Low Apdex Score" -# type = "static" - -# nrql { -# query = "FROM Transaction SELECT apdex(duration, t:0.5) WHERE appName = '${var.app_name}'" -# } - -# terms { -# threshold = 0.85 -# threshold_duration = 300 -# threshold_occurrences = "ALL" -# operator = "below" -# priority = "critical" -# } - -# signal { -# aggregation_window = 60 -# aggregation_method = "event_flow" -# } - -# enabled = true -# } + channel_id = newrelic_notification_channel.email_channel[each.value].id + } +} diff --git a/infra/new_relic/terraform.tfstate b/infra/new_relic/terraform.tfstate index a5635f71..439d3f21 100644 --- a/infra/new_relic/terraform.tfstate +++ b/infra/new_relic/terraform.tfstate @@ -1,404 +1,9 @@ { "version": 4, - "terraform_version": "1.11.4", - "serial": 32, + "terraform_version": "1.12.1", + "serial": 41, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, - "resources": [ - { - "mode": "data", - "type": "newrelic_entity", - "name": "app", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "application_id": 515583865, - "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"osRuntime\",\"values\":[\"docker\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", - "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", - "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", - "ignore_case": false, - "ignore_not_found": false, - "name": "rails_api_base - development", - "serving_apm_application_id": null, - "tag": null, - "type": "APPLICATION" - }, - "sensitive_attributes": [] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_alert_policy", - "name": "golden_metrics_policy", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6244865", - "incident_preference": "PER_POLICY", - "name": "Golden Signals - rails_api_base - development" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "data.newrelic_entity.app" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_notification_channel", - "name": "team_email_channel", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "active": true, - "destination_id": "6b854383-0902-4581-a1c1-93446b807cb3", - "id": "e96ada53-aa67-42db-8d19-31084385e26e", - "name": "email-example", - "product": "IINT", - "property": [ - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - }, - { - "display_value": "", - "key": "subject", - "label": "", - "value": "New Alert" - } - ], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_notification_destination.team_email_destination" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_notification_destination", - "name": "team_email_destination", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "active": true, - "auth_basic": [], - "auth_custom_header": [], - "auth_token": [], - "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnw2Yjg1NDM4My0wOTAyLTQ1ODEtYTFjMS05MzQ0NmI4MDdjYjM", - "id": "6b854383-0902-4581-a1c1-93446b807cb3", - "last_sent": "", - "name": "email-notification", - "property": [ - { - "display_value": "", - "key": "email", - "label": "", - "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" - }, - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - } - ], - "secure_url": [], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "error_rate", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 5, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTIzNTE", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6244865:51792351", - "ignore_on_expected_termination": false, - "name": "High Error Rate", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "FROM Transaction SELECT percentage(count(*), WHERE error IS true) AS 'error_rate' WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6244865, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "data.newrelic_entity.app", - "newrelic_alert_policy.golden_metrics_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "low_throughput", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "below", - "prediction": [], - "threshold": 1, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTIzNTA", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6244865:51792350", - "ignore_on_expected_termination": false, - "name": "Low Throughput", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6244865, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "data.newrelic_entity.app", - "newrelic_alert_policy.golden_metrics_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "response_time_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 5, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "High Transaction Response Time", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE3OTI1NTI", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6244865:51792552", - "ignore_on_expected_termination": false, - "name": "Response Time - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT filter(average(newrelic.timeslice.value), WHERE metricTimesliceName = 'HttpDispatcher') OR 0 FROM Metric WHERE appId IN (515583865) AND metricTimesliceName IN ('HttpDispatcher', 'Agent/MetricsReported/count')", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6244865, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "ONE_HOUR", - "violation_time_limit_seconds": 3600, - "warning": [] - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "data.newrelic_entity.app", - "newrelic_alert_policy.golden_metrics_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_workflow", - "name": "team_workflow", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "destination": [ - { - "channel_id": "e96ada53-aa67-42db-8d19-31084385e26e", - "name": "email-example", - "notification_triggers": [ - "ACKNOWLEDGED", - "ACTIVATED", - "CLOSED" - ], - "type": "EMAIL", - "update_original_message": true - } - ], - "destinations_enabled": true, - "enabled": true, - "enrichments": [], - "enrichments_enabled": true, - "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3wwZDhlYmZiZC1mZWY0LTRiZjgtYTg5My1lNTA5M2NlODQ3OWI", - "id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b", - "issues_filter": [ - { - "filter_id": "f9913086-029e-46a0-b465-3f1488eaa7dc", - "name": "filter-example", - "predicate": [ - { - "attribute": "accumulations.policyName", - "operator": "EXACTLY_MATCHES", - "values": [ - "Golden Signals - rails_api_base - development" - ] - } - ], - "type": "FILTER" - } - ], - "last_run": "2025-05-20T18:32:12.905Z", - "muting_rules_handling": "NOTIFY_ALL_ISSUES", - "name": "workflow-example", - "workflow_id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b" - }, - "sensitive_attributes": [], - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", - "dependencies": [ - "data.newrelic_entity.app", - "newrelic_alert_policy.golden_metrics_policy", - "newrelic_notification_channel.team_email_channel", - "newrelic_notification_destination.team_email_destination" - ] - } - ] - } - ], + "resources": [], "check_results": null } diff --git a/infra/new_relic/terraform.tfstate.backup b/infra/new_relic/terraform.tfstate.backup index 79ffabcf..eb6cecc6 100644 --- a/infra/new_relic/terraform.tfstate.backup +++ b/infra/new_relic/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, - "terraform_version": "1.11.4", - "serial": 29, + "terraform_version": "1.12.1", + "serial": 32, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -27,7 +27,8 @@ "tag": null, "type": "APPLICATION" }, - "sensitive_attributes": [] + "sensitive_attributes": [], + "identity_schema_version": 0 } ] }, @@ -47,6 +48,7 @@ "name": "Golden Signals - rails_api_base - development" }, "sensitive_attributes": [], + "identity_schema_version": 0, "private": "bnVsbA==", "dependencies": [ "data.newrelic_entity.app" @@ -88,6 +90,7 @@ "type": "EMAIL" }, "sensitive_attributes": [], + "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", "dependencies": [ "newrelic_notification_destination.team_email_destination" @@ -133,6 +136,7 @@ "type": "EMAIL" }, "sensitive_attributes": [], + "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" } ] @@ -196,73 +200,7 @@ "warning": [] }, "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "data.newrelic_entity.app", - "newrelic_alert_policy.golden_metrics_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "exceptions", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTE5NzUwOTU", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6244865:51975095", - "ignore_on_expected_termination": false, - "name": "Exceptions Detected", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "FROM TransactionError SELECT count(*), latest(message) as 'Error Message', latest(error.class) as 'Error Class', latest(transactionName) as 'Transaction', latest(request.uri) as 'URI' WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6244865, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], + "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ "data.newrelic_entity.app", @@ -330,6 +268,7 @@ "warning": [] }, "sensitive_attributes": [], + "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ "data.newrelic_entity.app", @@ -397,6 +336,7 @@ "warning": [] }, "sensitive_attributes": [], + "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ "data.newrelic_entity.app", @@ -456,6 +396,7 @@ "workflow_id": "0d8ebfbd-fef4-4bf8-a893-e5093ce8479b" }, "sensitive_attributes": [], + "identity_schema_version": 0, "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", "dependencies": [ "data.newrelic_entity.app", From c50c2c57e4003dae5540219563cf18cba0f4c5d4 Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Thu, 5 Jun 2025 17:05:42 -0300 Subject: [PATCH 06/16] WIP dashboards --- infra/new_relic/.env.sample | 2 +- infra/new_relic/alerts.tf | 232 +++++++ infra/new_relic/terraform.tfstate | 782 ++++++++++++++++++++++- infra/new_relic/terraform.tfstate.backup | 477 ++++++++++++-- 4 files changed, 1439 insertions(+), 54 deletions(-) diff --git a/infra/new_relic/.env.sample b/infra/new_relic/.env.sample index 372a2255..ea13b205 100644 --- a/infra/new_relic/.env.sample +++ b/infra/new_relic/.env.sample @@ -7,4 +7,4 @@ TF_VAR_app_name='["rails_api_base - development"]' TF_VAR_endpoints='["/api/v1/users", "/api/v1/orders"]' # Map of endpoint-specific P95 thresholds (in seconds) to override. # Not needed if you're ok with the default of 60 seconds. -TF_VAR_endpoint_thresholds='{ "/api/v1/orders": 2.0 }' +TF_VAR_endpoint_thresholds='{ "/api/v1/orders": { "p90": 2.0 } }' diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 81715911..e2c5ae7f 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -21,6 +21,11 @@ variable "app_name" { ] } +variable "account_id" { + type = number + description = "New Relic account ID." +} + # List of endpoints to monitor for latency variable "endpoints" { type = list(string) @@ -216,6 +221,233 @@ resource "newrelic_nrql_alert_condition" "endpoint_p95" { } } +####################################### +# DASHBOARDS # +####################################### +resource "newrelic_one_dashboard" "exampledash" { + name = "New Relic Terraform Example" + permissions = "private" + + page { + name = "New Relic Terraform Example" + + widget_table { + title = "List of Transactions" + row = 1 + column = 4 + width = 6 + height = 3 + + refresh_rate = 60000 // data refreshes every 60 seconds + + nrql_query { + query = "FROM Transaction SELECT *" + } + + initial_sorting { + direction = "desc" + name = "timestamp" + } + + data_format { + name = "duration" + type = "decimal" + } + } + + widget_billboard { + title = "Requests per minute" + row = 1 + column = 1 + width = 6 + height = 3 + + refresh_rate = 60000 // 60 seconds + + data_format { + name = "rate" + type = "recent-relative" + } + + nrql_query { + query = "FROM Transaction SELECT rate(count(*), 1 minute)" + } + } + + # widget_bar { + # title = "Average transaction duration, by application" + # row = 1 + # column = 7 + # width = 6 + # height = 3 + + # nrql_query { + # query = "FROM Transaction SELECT average(duration) FACET appName" + # } + + # # Must be another dashboard GUID + # linked_entity_guids = ["abc123"] + # } + + # widget_bar { + # title = "Average transaction duration, by application" + # row = 4 + # column = 1 + # width = 6 + # height = 3 + + # refresh_rate = 300000 // 5 minutes + + # nrql_query { + # query = "FROM Transaction SELECT average(duration) FACET appName" + # } + + # # Must be another dashboard GUID + # filter_current_dashboard = true + + # # color customization + # colors { + # color = "#722727" + # series_overrides { + # color = "#722322" + # series_name = "Node" + # } + # series_overrides { + # color = "#236f70" + # series_name = "Java" + # } + # } + # } + + widget_line { + title = "Average transaction duration and the request per minute, by application" + row = 4 + column = 7 + width = 6 + height = 3 + + refresh_rate = 30000 // 30 seconds + + nrql_query { + query = "FROM Transaction select max(duration) as 'max duration' where httpResponseCode = '504' timeseries since 5 minutes ago" + } + + nrql_query { + query = "FROM Transaction SELECT rate(count(*), 1 minute)" + } + legend_enabled = true + ignore_time_range = false + y_axis_left_zero = true + y_axis_left_min = 0 + y_axis_left_max = 1 + + y_axis_right { + y_axis_right_zero = true + y_axis_right_min = 0 + y_axis_right_max = 300 + y_axis_right_series = ["A", "B"] + } + + is_label_visible = true + + threshold { + name = "Duration Threshold" + from = 1 + to = 2 + severity = "critical" + } + + threshold { + name = "Duration Threshold Two" + from = 2.1 + to = 3.3 + severity = "warning" + } + + units { + unit = "ms" + series_overrides { + unit = "ms" + series_name = "max duration" + } + } + + + } + + # widget_markdown { + # title = "Dashboard Note" + # row = 7 + # column = 1 + # width = 12 + # height = 3 + + # text = "### Helpful Links\n\n* [New Relic One](https://one.newrelic.com)\n* [Developer Portal](https://developer.newrelic.com)" + # } + +# widget_line { +# title = "Overall CPU % Statistics" +# row = 1 +# column = 5 +# height = 3 +# width = 4 + +# nrql_query { +# query = < Date: Fri, 6 Jun 2025 16:07:25 -0300 Subject: [PATCH 07/16] WIP --- infra/new_relic/alerts.tf | 49 +- infra/new_relic/dashboard.json | 590 +++++++++++++++++++++++ infra/new_relic/dashboard2.json | 561 +++++++++++++++++++++ infra/new_relic/terraform.tfstate | 79 ++- infra/new_relic/terraform.tfstate.backup | 8 +- 5 files changed, 1199 insertions(+), 88 deletions(-) create mode 100644 infra/new_relic/dashboard.json create mode 100644 infra/new_relic/dashboard2.json diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index e2c5ae7f..6ddd9d19 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -231,30 +231,6 @@ resource "newrelic_one_dashboard" "exampledash" { page { name = "New Relic Terraform Example" - widget_table { - title = "List of Transactions" - row = 1 - column = 4 - width = 6 - height = 3 - - refresh_rate = 60000 // data refreshes every 60 seconds - - nrql_query { - query = "FROM Transaction SELECT *" - } - - initial_sorting { - direction = "desc" - name = "timestamp" - } - - data_format { - name = "duration" - type = "decimal" - } - } - widget_billboard { title = "Requests per minute" row = 1 @@ -274,20 +250,17 @@ resource "newrelic_one_dashboard" "exampledash" { } } - # widget_bar { - # title = "Average transaction duration, by application" - # row = 1 - # column = 7 - # width = 6 - # height = 3 - - # nrql_query { - # query = "FROM Transaction SELECT average(duration) FACET appName" - # } + widget_bar { + title = "Average transaction duration, by application" + row = 1 + column = 7 + width = 6 + height = 3 - # # Must be another dashboard GUID - # linked_entity_guids = ["abc123"] - # } + nrql_query { + query = "FROM Transaction SELECT average(duration) FACET appName" + } + } # widget_bar { # title = "Average transaction duration, by application" @@ -352,7 +325,7 @@ resource "newrelic_one_dashboard" "exampledash" { threshold { name = "Duration Threshold" - from = 1 + from = 1 to = 2 severity = "critical" } diff --git a/infra/new_relic/dashboard.json b/infra/new_relic/dashboard.json new file mode 100644 index 00000000..f26dcbfc --- /dev/null +++ b/infra/new_relic/dashboard.json @@ -0,0 +1,590 @@ +{ + "name": "Activerecord", + "description": null, + "permissions": "PUBLIC_READ_WRITE", + "pages": [ + { + "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfDM5MTQ3Mjkz", + "name": "Activerecord Overview", + "description": null, + "widgets": [ + { + "id": "431616673", + "title": null, + "layout": { + "column": 1, + "row": 1, + "width": 5, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.markdown" + }, + "rawConfiguration": { + "text": "\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\n" + } + }, + { + "id": "431616674", + "title": "Transactions Overview", + "layout": { + "column": 6, + "row": 1, + "width": 7, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName LIKE '%'" + } + ], + "thresholds": [] + } + }, + { + "id": "431616675", + "title": null, + "layout": { + "column": 1, + "row": 4, + "width": 5, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.markdown" + }, + "rawConfiguration": { + "text": "\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\n" + } + }, + { + "id": "431616676", + "title": "Errors Overview", + "layout": { + "column": 6, + "row": 4, + "width": 7, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName LIKE '%'" + } + ], + "thresholds": [] + } + }, + { + "id": "431616677", + "title": null, + "layout": { + "column": 1, + "row": 7, + "width": 5, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.markdown" + }, + "rawConfiguration": { + "text": "\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\n" + } + }, + { + "id": "431616678", + "title": "VM Overview", + "layout": { + "column": 6, + "row": 7, + "width": 7, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName like '%' SINCE 1 WEEK AGO" + } + ], + "thresholds": [] + } + }, + { + "id": "431616679", + "title": null, + "layout": { + "column": 5, + "row": 10, + "width": 5, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.markdown" + }, + "rawConfiguration": { + "text": "## More details available on Application Monitoring (APM) page.\nDive deeper on transaction details, distributed tracing, related entities, anomalies, errors\nand more. [Open the Explorer.](https://onenr.io/0rVRVGaNWja)" + } + } + ] + }, + { + "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfDM5MTQ3Mjk0", + "name": "Errors", + "description": null, + "widgets": [ + { + "id": "431616680", + "title": "Error Overview", + "layout": { + "column": 1, + "row": 1, + "width": 8, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago" + } + ], + "thresholds": [] + } + }, + { + "id": "431616681", + "title": "Top 10 Failed Transactions", + "layout": { + "column": 9, + "row": 1, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [], + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week" + } + ] + } + }, + { + "id": "431616682", + "title": "Transactions Errors Today Compared With 1 Week Ago", + "layout": { + "column": 1, + "row": 4, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.line" + }, + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago" + } + ], + "yAxisLeft": { + "zero": true + } + } + }, + { + "id": "431616683", + "title": "Latest Error", + "layout": { + "column": 5, + "row": 4, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week " + } + ], + "thresholds": [] + } + }, + { + "id": "431616684", + "title": "Transaction Errors Day By Day", + "layout": { + "column": 9, + "row": 4, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "dc5b694f-9125-4c64-8e4e-c52e604c8088.range-chart" + }, + "rawConfiguration": { + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM TransactionError SELECT count(*), percentage(count(*), WHERE error IS true) FACET dateOf(timestamp) SINCE 1 week ago" + } + ], + "other": { + "visible": false + } + } + } + ] + }, + { + "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfDM5MTQ3Mjk1", + "name": "VM Metrics", + "description": null, + "widgets": [ + { + "id": "431616685", + "title": "VM Overview", + "layout": { + "column": 1, + "row": 1, + "width": 7, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName like '%' SINCE 1 WEEK AGO" + } + ], + "thresholds": [] + } + }, + { + "id": "431616686", + "title": "CPU Utilization", + "layout": { + "column": 8, + "row": 1, + "width": 5, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.area" + }, + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName like '%' SINCE 30 minutes ago TIMESERIES" + } + ] + } + }, + { + "id": "431616687", + "title": "Average Physical Memory", + "layout": { + "column": 1, + "row": 4, + "width": 12, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.area" + }, + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT average(apm.service.memory.physical) FROM Metric WHERE appName like '%' SINCE 30 minutes ago TIMESERIES" + } + ] + } + } + ] + }, + { + "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfDM5MTQ3Mjk2", + "name": "Transactions", + "description": null, + "widgets": [ + { + "id": "431616688", + "title": "Transactions Overview", + "layout": { + "column": 1, + "row": 1, + "width": 7, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.billboard" + }, + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName LIKE '%' SINCE 1 WEEK AGO" + } + ], + "thresholds": [] + } + }, + { + "id": "431616689", + "title": "Most Popular Transactions", + "layout": { + "column": 8, + "row": 1, + "width": 5, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.pie" + }, + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name" + } + ] + } + }, + { + "id": "431616690", + "title": "Adpex Score Today Compared With 1 Week Ago", + "layout": { + "column": 1, + "row": 4, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.line" + }, + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago" + } + ], + "yAxisLeft": { + "zero": true + } + } + }, + { + "id": "431616691", + "title": "Throughput Today Compared With 1 Week Ago", + "layout": { + "column": 5, + "row": 4, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.line" + }, + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago" + } + ], + "yAxisLeft": { + "zero": true + } + } + }, + { + "id": "431616692", + "title": "Average Transaction Duration Today Compared With 1 Week Ago", + "layout": { + "column": 9, + "row": 4, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.line" + }, + "rawConfiguration": { + "dataFormatters": [], + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago" + } + ], + "yAxisLeft": { + "zero": true + } + } + }, + { + "id": "431616693", + "title": "Top 5 Slowest Transactions", + "layout": { + "column": 1, + "row": 7, + "width": 4, + "height": 4 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "dc5b694f-9125-4c64-8e4e-c52e604c8088.stacked-bar-chart" + }, + "rawConfiguration": { + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name" + } + ], + "other": { + "visible": false + }, + "yAxis": { + "label": "Seconds" + } + } + }, + { + "id": "431616694", + "title": "Transactions Day By Day ", + "layout": { + "column": 5, + "row": 7, + "width": 8, + "height": 4 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "dc5b694f-9125-4c64-8e4e-c52e604c8088.range-chart" + }, + "rawConfiguration": { + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "FROM Transaction SELECT count(*), percentage(count(*), WHERE error IS false) FACET dateOf(timestamp) SINCE 1 week ago" + } + ], + "other": { + "visible": null + } + } + }, + { + "id": "431616695", + "title": "Transaction Duration Overview", + "layout": { + "column": 1, + "row": 11, + "width": 4, + "height": 3 + }, + "linkedEntityGuids": null, + "visualization": { + "id": "viz.table" + }, + "rawConfiguration": { + "dataFormatters": [], + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountId": 6572468, + "query": "SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName LIKE '%' FACET name" + } + ] + } + } + ] + } + ], + "variables": [] +} diff --git a/infra/new_relic/dashboard2.json b/infra/new_relic/dashboard2.json new file mode 100644 index 00000000..9e0aa017 --- /dev/null +++ b/infra/new_relic/dashboard2.json @@ -0,0 +1,561 @@ +{ + "name": "Activerecord", + "description": null, + "pages": [ + { + "name": "Activerecord Overview", + "description": null, + "widgets": [ + { + "visualization": { + "id": "viz.markdown" + }, + "layout": { + "column": 1, + "row": 1, + "height": 3, + "width": 5 + }, + "title": "", + "rawConfiguration": { + "text": "\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\n" + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.billboard" + }, + "layout": { + "column": 6, + "row": 1, + "height": 3, + "width": 7 + }, + "title": "Transactions Overview", + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName LIKE '%'" + } + ], + "thresholds": [] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.markdown" + }, + "layout": { + "column": 1, + "row": 4, + "height": 3, + "width": 5 + }, + "title": "", + "rawConfiguration": { + "text": "\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\n" + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.billboard" + }, + "layout": { + "column": 6, + "row": 4, + "height": 3, + "width": 7 + }, + "title": "Errors Overview", + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName LIKE '%'" + } + ], + "thresholds": [] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.markdown" + }, + "layout": { + "column": 1, + "row": 7, + "height": 3, + "width": 5 + }, + "title": "", + "rawConfiguration": { + "text": "\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\n" + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.billboard" + }, + "layout": { + "column": 6, + "row": 7, + "height": 3, + "width": 7 + }, + "title": "VM Overview", + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName like '%' SINCE 1 WEEK AGO" + } + ], + "thresholds": [] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.markdown" + }, + "layout": { + "column": 5, + "row": 10, + "height": 3, + "width": 5 + }, + "title": "", + "rawConfiguration": { + "text": "## More details available on Application Monitoring (APM) page.\nDive deeper on transaction details, distributed tracing, related entities, anomalies, errors\nand more. [Open the Explorer.](https://onenr.io/0rVRVGaNWja)" + }, + "linkedEntityGuids": null + } + ] + }, + { + "name": "Errors", + "description": null, + "widgets": [ + { + "visualization": { + "id": "viz.billboard" + }, + "layout": { + "column": 1, + "row": 1, + "height": 3, + "width": 8 + }, + "title": "Error Overview", + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago" + } + ], + "thresholds": [] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.table" + }, + "layout": { + "column": 9, + "row": 1, + "height": 3, + "width": 4 + }, + "title": "Top 10 Failed Transactions", + "rawConfiguration": { + "dataFormatters": [], + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week" + } + ] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.line" + }, + "layout": { + "column": 1, + "row": 4, + "height": 3, + "width": 4 + }, + "title": "Transactions Errors Today Compared With 1 Week Ago", + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago" + } + ], + "yAxisLeft": { + "zero": true + } + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.billboard" + }, + "layout": { + "column": 5, + "row": 4, + "height": 3, + "width": 4 + }, + "title": "Latest Error", + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week " + } + ], + "thresholds": [] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "dc5b694f-9125-4c64-8e4e-c52e604c8088.range-chart" + }, + "layout": { + "column": 9, + "row": 4, + "height": 3, + "width": 4 + }, + "title": "Transaction Errors Day By Day", + "rawConfiguration": { + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM TransactionError SELECT count(*), percentage(count(*), WHERE error IS true) FACET dateOf(timestamp) SINCE 1 week ago" + } + ], + "other": { + "visible": false + } + }, + "linkedEntityGuids": null + } + ] + }, + { + "name": "VM Metrics", + "description": null, + "widgets": [ + { + "visualization": { + "id": "viz.billboard" + }, + "layout": { + "column": 1, + "row": 1, + "height": 3, + "width": 7 + }, + "title": "VM Overview", + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName like '%' SINCE 1 WEEK AGO" + } + ], + "thresholds": [] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.area" + }, + "layout": { + "column": 8, + "row": 1, + "height": 3, + "width": 5 + }, + "title": "CPU Utilization", + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName like '%' SINCE 30 minutes ago TIMESERIES" + } + ] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.area" + }, + "layout": { + "column": 1, + "row": 4, + "height": 3, + "width": 12 + }, + "title": "Average Physical Memory", + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT average(apm.service.memory.physical) FROM Metric WHERE appName like '%' SINCE 30 minutes ago TIMESERIES" + } + ] + }, + "linkedEntityGuids": null + } + ] + }, + { + "name": "Transactions", + "description": null, + "widgets": [ + { + "visualization": { + "id": "viz.billboard" + }, + "layout": { + "column": 1, + "row": 1, + "height": 3, + "width": 7 + }, + "title": "Transactions Overview", + "rawConfiguration": { + "dataFormatters": [], + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName LIKE '%' SINCE 1 WEEK AGO" + } + ], + "thresholds": [] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.pie" + }, + "layout": { + "column": 8, + "row": 1, + "height": 3, + "width": 5 + }, + "title": "Most Popular Transactions", + "rawConfiguration": { + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name" + } + ] + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.line" + }, + "layout": { + "column": 1, + "row": 4, + "height": 3, + "width": 4 + }, + "title": "Adpex Score Today Compared With 1 Week Ago", + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago" + } + ], + "yAxisLeft": { + "zero": true + } + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.line" + }, + "layout": { + "column": 5, + "row": 4, + "height": 3, + "width": 4 + }, + "title": "Throughput Today Compared With 1 Week Ago", + "rawConfiguration": { + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago" + } + ], + "yAxisLeft": { + "zero": true + } + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.line" + }, + "layout": { + "column": 9, + "row": 4, + "height": 3, + "width": 4 + }, + "title": "Average Transaction Duration Today Compared With 1 Week Ago", + "rawConfiguration": { + "dataFormatters": [], + "legend": { + "enabled": true + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago" + } + ], + "yAxisLeft": { + "zero": true + } + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "dc5b694f-9125-4c64-8e4e-c52e604c8088.stacked-bar-chart" + }, + "layout": { + "column": 1, + "row": 7, + "height": 4, + "width": 4 + }, + "title": "Top 5 Slowest Transactions", + "rawConfiguration": { + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name" + } + ], + "other": { + "visible": false + }, + "yAxis": { + "label": "Seconds" + } + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "dc5b694f-9125-4c64-8e4e-c52e604c8088.range-chart" + }, + "layout": { + "column": 5, + "row": 7, + "height": 4, + "width": 8 + }, + "title": "Transactions Day By Day ", + "rawConfiguration": { + "nrqlQueries": [ + { + "accountId": 0, + "query": "FROM Transaction SELECT count(*), percentage(count(*), WHERE error IS false) FACET dateOf(timestamp) SINCE 1 week ago" + } + ], + "other": { + "visible": null + } + }, + "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.table" + }, + "layout": { + "column": 1, + "row": 11, + "height": 3, + "width": 4 + }, + "title": "Transaction Duration Overview", + "rawConfiguration": { + "dataFormatters": [], + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountId": 0, + "query": "SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName LIKE '%' FACET name" + } + ] + }, + "linkedEntityGuids": null + } + ] + } + ] +} diff --git a/infra/new_relic/terraform.tfstate b/infra/new_relic/terraform.tfstate index 2f7d8752..b4bdb158 100644 --- a/infra/new_relic/terraform.tfstate +++ b/infra/new_relic/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.12.1", - "serial": 71, + "serial": 73, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -18,7 +18,7 @@ "account_id": 6572468, "application_id": 515583865, "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"osRuntime\",\"values\":[\"docker\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", "ignore_case": false, @@ -524,7 +524,35 @@ "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfDM5MTMwMjc0", "name": "New Relic Terraform Example", "widget_area": [], - "widget_bar": [], + "widget_bar": [ + { + "colors": [], + "column": 7, + "data_format": [], + "facet_show_other_series": false, + "filter_current_dashboard": false, + "height": 3, + "id": "431615733", + "ignore_time_range": false, + "initial_sorting": [], + "legend_enabled": true, + "linked_entity_guids": [], + "nrql_query": [ + { + "account_id": 6572468, + "query": "FROM Transaction SELECT average(duration) FACET appName" + } + ], + "null_values": [], + "refresh_rate": "", + "row": 1, + "title": "Average transaction duration, by application", + "units": [], + "width": 6, + "y_axis_left_max": 0, + "y_axis_left_min": 0 + } + ], "widget_billboard": [ { "colors": [], @@ -638,48 +666,7 @@ "widget_markdown": [], "widget_pie": [], "widget_stacked_bar": [], - "widget_table": [ - { - "colors": [], - "column": 4, - "data_format": [ - { - "format": "", - "name": "duration", - "precision": 0, - "type": "decimal" - } - ], - "facet_show_other_series": false, - "filter_current_dashboard": false, - "height": 3, - "id": "431450067", - "ignore_time_range": false, - "initial_sorting": [ - { - "direction": "desc", - "name": "timestamp" - } - ], - "legend_enabled": true, - "linked_entity_guids": [], - "nrql_query": [ - { - "account_id": 6572468, - "query": "FROM Transaction SELECT *" - } - ], - "null_values": [], - "refresh_rate": "60000", - "row": 1, - "threshold": [], - "title": "List of Transactions", - "units": [], - "width": 6, - "y_axis_left_max": 0, - "y_axis_left_min": 0 - } - ] + "widget_table": [] } ], "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTM4MTQz", @@ -765,7 +752,7 @@ "type": "FILTER" } ], - "last_run": "", + "last_run": "2025-06-06T18:28:45.660Z", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "Workflow - rails_api_base - development", "workflow_id": "1e9983ee-e9ab-4914-8178-6c3717f2fd69" diff --git a/infra/new_relic/terraform.tfstate.backup b/infra/new_relic/terraform.tfstate.backup index e618fcac..2f7d8752 100644 --- a/infra/new_relic/terraform.tfstate.backup +++ b/infra/new_relic/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.12.1", - "serial": 69, + "serial": 71, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -696,18 +696,18 @@ "value": "ITEM" } ], - "name": "variable", + "name": "app_name", "nrql_query": [ { "account_ids": [ 6572468 ], - "query": "FROM Transaction SELECT average(duration) FACET appName" + "query": "FROM Transaction SELECT distinct(appName)" } ], "options": [], "replacement_strategy": "default", - "title": "title", + "title": "app_name", "type": "nrql" } ] From 68906b9ae32ef8ba2e10b75b90a079d7d332d12b Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Wed, 11 Jun 2025 16:19:11 -0300 Subject: [PATCH 08/16] Dashboard setup with json template --- infra/new_relic/alerts.tf | 200 +----- infra/new_relic/dashboard.json | 590 ------------------ .../{dashboard2.json => dashboard.json.tftpl} | 398 +++++------- infra/new_relic/terraform.tfstate | 201 +----- infra/new_relic/terraform.tfstate.backup | 101 +-- 5 files changed, 242 insertions(+), 1248 deletions(-) delete mode 100644 infra/new_relic/dashboard.json rename infra/new_relic/{dashboard2.json => dashboard.json.tftpl} (54%) diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 6ddd9d19..a07e2946 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -224,203 +224,15 @@ resource "newrelic_nrql_alert_condition" "endpoint_p95" { ####################################### # DASHBOARDS # ####################################### -resource "newrelic_one_dashboard" "exampledash" { - name = "New Relic Terraform Example" - permissions = "private" - - page { - name = "New Relic Terraform Example" - - widget_billboard { - title = "Requests per minute" - row = 1 - column = 1 - width = 6 - height = 3 - - refresh_rate = 60000 // 60 seconds - - data_format { - name = "rate" - type = "recent-relative" - } - - nrql_query { - query = "FROM Transaction SELECT rate(count(*), 1 minute)" - } - } - - widget_bar { - title = "Average transaction duration, by application" - row = 1 - column = 7 - width = 6 - height = 3 - - nrql_query { - query = "FROM Transaction SELECT average(duration) FACET appName" - } - } - - # widget_bar { - # title = "Average transaction duration, by application" - # row = 4 - # column = 1 - # width = 6 - # height = 3 - - # refresh_rate = 300000 // 5 minutes - - # nrql_query { - # query = "FROM Transaction SELECT average(duration) FACET appName" - # } - - # # Must be another dashboard GUID - # filter_current_dashboard = true - - # # color customization - # colors { - # color = "#722727" - # series_overrides { - # color = "#722322" - # series_name = "Node" - # } - # series_overrides { - # color = "#236f70" - # series_name = "Java" - # } - # } - # } - - widget_line { - title = "Average transaction duration and the request per minute, by application" - row = 4 - column = 7 - width = 6 - height = 3 - - refresh_rate = 30000 // 30 seconds - - nrql_query { - query = "FROM Transaction select max(duration) as 'max duration' where httpResponseCode = '504' timeseries since 5 minutes ago" - } - - nrql_query { - query = "FROM Transaction SELECT rate(count(*), 1 minute)" - } - legend_enabled = true - ignore_time_range = false - y_axis_left_zero = true - y_axis_left_min = 0 - y_axis_left_max = 1 - - y_axis_right { - y_axis_right_zero = true - y_axis_right_min = 0 - y_axis_right_max = 300 - y_axis_right_series = ["A", "B"] - } - - is_label_visible = true - - threshold { - name = "Duration Threshold" - from = 1 - to = 2 - severity = "critical" - } - - threshold { - name = "Duration Threshold Two" - from = 2.1 - to = 3.3 - severity = "warning" - } - - units { - unit = "ms" - series_overrides { - unit = "ms" - series_name = "max duration" - } - } - - - } - # widget_markdown { - # title = "Dashboard Note" - # row = 7 - # column = 1 - # width = 12 - # height = 3 - - # text = "### Helpful Links\n\n* [New Relic One](https://one.newrelic.com)\n* [Developer Portal](https://developer.newrelic.com)" - # } - -# widget_line { -# title = "Overall CPU % Statistics" -# row = 1 -# column = 5 -# height = 3 -# width = 4 - -# nrql_query { -# query = < Date: Fri, 13 Jun 2025 15:18:21 -0300 Subject: [PATCH 09/16] Add non-web transactions to dashboard and improve error alert --- infra/new_relic/alerts.tf | 12 +- infra/new_relic/dashboard.json.tftpl | 27 +- infra/new_relic/terraform.tfstate | 571 +++++++++++++++-- infra/new_relic/terraform.tfstate.backup | 750 ++++++++++++++++------- 4 files changed, 1083 insertions(+), 277 deletions(-) diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index a07e2946..0bd31891 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -108,24 +108,24 @@ resource "newrelic_nrql_alert_condition" "low_throughput" { } # Error rate condition -resource "newrelic_nrql_alert_condition" "error_rate" { +resource "newrelic_nrql_alert_condition" "error_alert" { for_each = toset(var.app_name) policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id type = "static" - name = "High Error Rate - ${each.value}" - description = "High Error Rate" + name = "Error alert - ${each.value}" + description = "Error Alert" enabled = true violation_time_limit_seconds = 259200 # 3 days nrql { - query = "SELECT (filter(count(*), WHERE error IS true) / count(*)) * 100 AS 'error_rate' FROM Transaction WHERE appName = '${each.value}'" + query = "SELECT count(*) FROM Transaction WHERE error IS true AND appName = '${each.value}'" } critical { - threshold = 5 + threshold = 1 threshold_duration = 60 threshold_occurrences = "ALL" - operator = "above" + operator = "above_or_equals" } } diff --git a/infra/new_relic/dashboard.json.tftpl b/infra/new_relic/dashboard.json.tftpl index 6a0a134b..3ff8d761 100644 --- a/infra/new_relic/dashboard.json.tftpl +++ b/infra/new_relic/dashboard.json.tftpl @@ -163,7 +163,7 @@ "height": 3, "width": 4 }, - "title": "Top 10 Failed Transactions", + "title": "Top 10 Failed Web Transactions", "rawConfiguration": { "dataFormatters": [], "facet": { @@ -227,6 +227,31 @@ "thresholds": [] }, "linkedEntityGuids": null + }, + { + "visualization": { + "id": "viz.table" + }, + "layout": { + "column": 9, + "row": 4, + "height": 3, + "width": 4 + }, + "title": "Top 10 Failed Non-Web Transactions", + "rawConfiguration": { + "dataFormatters": [], + "facet": { + "showOtherSeries": false + }, + "nrqlQueries": [ + { + "accountId": "${account_id}", + "query": "Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = '${app_name}'" + } + ] + }, + "linkedEntityGuids": null } ] }, diff --git a/infra/new_relic/terraform.tfstate b/infra/new_relic/terraform.tfstate index b6fff4c3..eb01dfd5 100644 --- a/infra/new_relic/terraform.tfstate +++ b/infra/new_relic/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, - "terraform_version": "1.12.1", - "serial": 103, + "terraform_version": "1.12.2", + "serial": 198, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -30,6 +30,26 @@ }, "sensitive_attributes": [], "identity_schema_version": 0 + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "application_id": 524986998, + "domain": "APM", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", + "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", + "ignore_case": false, + "ignore_not_found": false, + "name": "rails_api_base - development2", + "serving_apm_application_id": null, + "tag": null, + "type": "APPLICATION" + }, + "sensitive_attributes": [], + "identity_schema_version": 0 } ] }, @@ -45,13 +65,27 @@ "attributes": { "account_id": 6572468, "channel_ids": null, - "id": "6312903", + "id": "6333783", "incident_preference": "PER_POLICY", "name": "Golden Signals - rails_api_base - development" }, "sensitive_attributes": [], "identity_schema_version": 0, "private": "bnVsbA==" + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "channel_ids": null, + "id": "6333785", + "incident_preference": "PER_POLICY", + "name": "Golden Signals - rails_api_base - development2" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "bnVsbA==" } ] }, @@ -67,13 +101,27 @@ "attributes": { "account_id": 6572468, "channel_ids": null, - "id": "6312902", + "id": "6333782", "incident_preference": "PER_POLICY", "name": "Percentiles - rails_api_base - development" }, "sensitive_attributes": [], "identity_schema_version": 0, "private": "bnVsbA==" + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "channel_ids": null, + "id": "6333784", + "incident_preference": "PER_POLICY", + "name": "Percentiles - rails_api_base - development2" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "bnVsbA==" } ] }, @@ -89,8 +137,8 @@ "attributes": { "account_id": 6572468, "active": true, - "destination_id": "c0d4893f-ebf1-4887-aadb-29da68ee5fd1", - "id": "7a447725-2859-440e-89db-4917e732bcf5", + "destination_id": "d3934e69-fe90-4958-840d-052bfb0864d3", + "id": "382405ca-0940-4337-ac0c-436ae392e5eb", "name": "Email channel - rails_api_base - development", "product": "IINT", "property": [ @@ -117,6 +165,41 @@ "dependencies": [ "newrelic_notification_destination.email_destination" ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "active": true, + "destination_id": "703ab473-75bf-41a6-8264-be5d0b15cce5", + "id": "c0b3137b-8afd-4aed-821b-92ca7cfa203e", + "name": "Email channel - rails_api_base - development2", + "product": "IINT", + "property": [ + { + "display_value": "", + "key": "source", + "label": "terraform-source-internal", + "value": "terraform" + }, + { + "display_value": "", + "key": "subject", + "label": "", + "value": "New Alert" + } + ], + "status": "DEFAULT", + "timeouts": null, + "type": "EMAIL" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_notification_destination.email_destination" + ] } ] }, @@ -135,8 +218,8 @@ "auth_basic": [], "auth_custom_header": [], "auth_token": [], - "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnxjMGQ0ODkzZi1lYmYxLTQ4ODctYWFkYi0yOWRhNjhlZTVmZDE", - "id": "c0d4893f-ebf1-4887-aadb-29da68ee5fd1", + "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnxkMzkzNGU2OS1mZTkwLTQ5NTgtODQwZC0wNTJiZmIwODY0ZDM", + "id": "d3934e69-fe90-4958-840d-052bfb0864d3", "last_sent": "", "name": "Email destination - rails_api_base - development", "property": [ @@ -161,13 +244,49 @@ "sensitive_attributes": [], "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 1, + "attributes": { + "account_id": 6572468, + "active": true, + "auth_basic": [], + "auth_custom_header": [], + "auth_token": [], + "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnw3MDNhYjQ3My03NWJmLTQxYTYtODI2NC1iZTVkMGIxNWNjZTU", + "id": "703ab473-75bf-41a6-8264-be5d0b15cce5", + "last_sent": "", + "name": "Email destination - rails_api_base - development2", + "property": [ + { + "display_value": "", + "key": "email", + "label": "", + "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" + }, + { + "display_value": "", + "key": "source", + "label": "terraform-source-internal", + "value": "terraform" + } + ], + "secure_url": [], + "status": "DEFAULT", + "timeouts": null, + "type": "EMAIL" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" } ] }, { "mode": "managed", "type": "newrelic_nrql_alert_condition", - "name": "error_rate", + "name": "error_alert", "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", "instances": [ { @@ -184,34 +303,94 @@ "critical": [ { "duration": 0, - "operator": "above", + "operator": "above_or_equals", "prediction": [], - "threshold": 5, + "threshold": 1, "threshold_duration": 60, "threshold_occurrences": "all", "time_function": "" } ], - "description": "High Error Rate", + "description": "Error Alert", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjI", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1Nzg4Mzk", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312903:52400422", + "id": "6333783:52578839", "ignore_on_expected_termination": false, - "name": "High Error Rate - rails_api_base - development", + "name": "Error alert - rails_api_base - development", "nrql": [ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "SELECT (filter(count(*), WHERE error IS true) / count(*)) * 100 AS 'error_rate' FROM Transaction WHERE appName = 'rails_api_base - development'", + "query": "SELECT count(*) FROM Transaction WHERE error IS true AND appName = 'rails_api_base - development'", "since_value": "" } ], "open_violation_on_expiration": false, - "policy_id": 6312903, + "policy_id": 6333783, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above_or_equals", + "prediction": [], + "threshold": 1, + "threshold_duration": 60, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "Error Alert", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1Nzg4NDA", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333785:52578840", + "ignore_on_expected_termination": false, + "name": "Error alert - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT count(*) FROM Transaction WHERE error IS true AND appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333785, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -262,12 +441,12 @@ ], "description": "Low Throughput", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjA", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzM", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312903:52400420", + "id": "6333783:52578173", "ignore_on_expected_termination": false, "name": "Low Throughput - rails_api_base - development", "nrql": [ @@ -279,7 +458,67 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6312903, + "policy_id": 6333783, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "below", + "prediction": [], + "threshold": 5, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "Low Throughput", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDk", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333785:52578209", + "ignore_on_expected_termination": false, + "name": "Low Throughput - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333785, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -330,12 +569,12 @@ ], "description": "P90 Alert", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjQ", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzI", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312902:52400424", + "id": "6333782:52578172", "ignore_on_expected_termination": false, "name": "P90 Alert - rails_api_base - development", "nrql": [ @@ -347,7 +586,67 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6312902, + "policy_id": 6333782, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.percentiles_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 1.5, + "threshold_duration": 60, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "P90 Alert", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDc", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333784:52578207", + "ignore_on_expected_termination": false, + "name": "P90 Alert - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333784, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -398,12 +697,12 @@ ], "description": "P95 Alert", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjE", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzE", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312902:52400421", + "id": "6333782:52578171", "ignore_on_expected_termination": false, "name": "P95 Alert - rails_api_base - development", "nrql": [ @@ -415,7 +714,67 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6312902, + "policy_id": 6333782, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.percentiles_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 5, + "threshold_duration": 60, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "P95 Alert", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDY", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333784:52578206", + "ignore_on_expected_termination": false, + "name": "P95 Alert - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT percentile(duration, 95) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333784, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -466,12 +825,12 @@ ], "description": "High Transaction Response Time", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjM", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzQ", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312903:52400423", + "id": "6333783:52578174", "ignore_on_expected_termination": false, "name": "Response Time - rails_api_base - development", "nrql": [ @@ -483,7 +842,67 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6312903, + "policy_id": 6333783, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 5, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "High Transaction Response Time", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDg", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333785:52578208", + "ignore_on_expected_termination": false, + "name": "Response Time - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT average(duration) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333785, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -515,12 +934,28 @@ "schema_version": 0, "attributes": { "account_id": 6572468, - "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTc4MDA2", - "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTc4MDA2", - "json": "{\n \"name\": \"Activerecord - rails_api_base - development\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", - "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTc4MDA2", + "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", + "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", + "json": "{\n \"name\": \"Activerecord - rails_api_base - development\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Non-Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", + "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", + "timeouts": null, + "updated_at": "2025-06-13T17:36:34.946813Z" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMH19" + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", + "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", + "json": "{\n \"name\": \"Activerecord - rails_api_base - development2\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Non-Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development2' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development2' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development2' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", + "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", "timeouts": null, - "updated_at": "2025-06-11T19:18:02.511448Z" + "updated_at": "2025-06-13T17:36:35.057018Z" }, "sensitive_attributes": [], "identity_schema_version": 0, @@ -541,7 +976,7 @@ "account_id": 6572468, "destination": [ { - "channel_id": "7a447725-2859-440e-89db-4917e732bcf5", + "channel_id": "382405ca-0940-4337-ac0c-436ae392e5eb", "name": "Email channel - rails_api_base - development", "notification_triggers": [ "ACKNOWLEDGED", @@ -556,11 +991,11 @@ "enabled": true, "enrichments": [], "enrichments_enabled": true, - "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3wxZTk5ODNlZS1lOWFiLTQ5MTQtODE3OC02YzM3MTdmMmZkNjk", - "id": "1e9983ee-e9ab-4914-8178-6c3717f2fd69", + "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3xiMzIyOTIxNi0yZTcxLTRmNDktYjMxNi1mN2E3Y2E3OWEwN2Y", + "id": "b3229216-2e71-4f49-b316-f7a7ca79a07f", "issues_filter": [ { - "filter_id": "013df1c2-95f2-49a6-90bc-bcf702fdcde8", + "filter_id": "0ec8020f-7913-4786-a988-8adebf9f9d63", "name": "Filter - rails_api_base - development", "predicate": [ { @@ -575,10 +1010,66 @@ "type": "FILTER" } ], - "last_run": "2025-06-06T18:28:45.660Z", + "last_run": "", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "Workflow - rails_api_base - development", - "workflow_id": "1e9983ee-e9ab-4914-8178-6c3717f2fd69" + "workflow_id": "b3229216-2e71-4f49-b316-f7a7ca79a07f" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy", + "newrelic_alert_policy.percentiles_policy", + "newrelic_notification_channel.email_channel", + "newrelic_notification_destination.email_destination" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 1, + "attributes": { + "account_id": 6572468, + "destination": [ + { + "channel_id": "c0b3137b-8afd-4aed-821b-92ca7cfa203e", + "name": "Email channel - rails_api_base - development2", + "notification_triggers": [ + "ACKNOWLEDGED", + "ACTIVATED", + "CLOSED" + ], + "type": "EMAIL", + "update_original_message": true + } + ], + "destinations_enabled": true, + "enabled": true, + "enrichments": [], + "enrichments_enabled": true, + "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3xlNjdkNGVhMy1mMTFjLTQwODgtYjJmNi05OWQ2YjNmOTU1NTE", + "id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551", + "issues_filter": [ + { + "filter_id": "1b977d4e-e243-4a82-8d17-da8b039907e9", + "name": "Filter - rails_api_base - development2", + "predicate": [ + { + "attribute": "accumulations.policyName", + "operator": "EXACTLY_MATCHES", + "values": [ + "Golden Signals - rails_api_base - development2", + "Percentiles - rails_api_base - development2" + ] + } + ], + "type": "FILTER" + } + ], + "last_run": "", + "muting_rules_handling": "NOTIFY_ALL_ISSUES", + "name": "Workflow - rails_api_base - development2", + "workflow_id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551" }, "sensitive_attributes": [], "identity_schema_version": 0, diff --git a/infra/new_relic/terraform.tfstate.backup b/infra/new_relic/terraform.tfstate.backup index 6c6eb773..cbccc919 100644 --- a/infra/new_relic/terraform.tfstate.backup +++ b/infra/new_relic/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, - "terraform_version": "1.12.1", - "serial": 99, + "terraform_version": "1.12.2", + "serial": 196, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -30,6 +30,26 @@ }, "sensitive_attributes": [], "identity_schema_version": 0 + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "application_id": 524986998, + "domain": "APM", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", + "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", + "ignore_case": false, + "ignore_not_found": false, + "name": "rails_api_base - development2", + "serving_apm_application_id": null, + "tag": null, + "type": "APPLICATION" + }, + "sensitive_attributes": [], + "identity_schema_version": 0 } ] }, @@ -45,13 +65,27 @@ "attributes": { "account_id": 6572468, "channel_ids": null, - "id": "6312903", + "id": "6333783", "incident_preference": "PER_POLICY", "name": "Golden Signals - rails_api_base - development" }, "sensitive_attributes": [], "identity_schema_version": 0, "private": "bnVsbA==" + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "channel_ids": null, + "id": "6333785", + "incident_preference": "PER_POLICY", + "name": "Golden Signals - rails_api_base - development2" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "bnVsbA==" } ] }, @@ -67,13 +101,27 @@ "attributes": { "account_id": 6572468, "channel_ids": null, - "id": "6312902", + "id": "6333782", "incident_preference": "PER_POLICY", "name": "Percentiles - rails_api_base - development" }, "sensitive_attributes": [], "identity_schema_version": 0, "private": "bnVsbA==" + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "channel_ids": null, + "id": "6333784", + "incident_preference": "PER_POLICY", + "name": "Percentiles - rails_api_base - development2" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "bnVsbA==" } ] }, @@ -89,8 +137,8 @@ "attributes": { "account_id": 6572468, "active": true, - "destination_id": "c0d4893f-ebf1-4887-aadb-29da68ee5fd1", - "id": "7a447725-2859-440e-89db-4917e732bcf5", + "destination_id": "d3934e69-fe90-4958-840d-052bfb0864d3", + "id": "382405ca-0940-4337-ac0c-436ae392e5eb", "name": "Email channel - rails_api_base - development", "product": "IINT", "property": [ @@ -117,6 +165,41 @@ "dependencies": [ "newrelic_notification_destination.email_destination" ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "active": true, + "destination_id": "703ab473-75bf-41a6-8264-be5d0b15cce5", + "id": "c0b3137b-8afd-4aed-821b-92ca7cfa203e", + "name": "Email channel - rails_api_base - development2", + "product": "IINT", + "property": [ + { + "display_value": "", + "key": "source", + "label": "terraform-source-internal", + "value": "terraform" + }, + { + "display_value": "", + "key": "subject", + "label": "", + "value": "New Alert" + } + ], + "status": "DEFAULT", + "timeouts": null, + "type": "EMAIL" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_notification_destination.email_destination" + ] } ] }, @@ -135,8 +218,8 @@ "auth_basic": [], "auth_custom_header": [], "auth_token": [], - "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnxjMGQ0ODkzZi1lYmYxLTQ4ODctYWFkYi0yOWRhNjhlZTVmZDE", - "id": "c0d4893f-ebf1-4887-aadb-29da68ee5fd1", + "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnxkMzkzNGU2OS1mZTkwLTQ5NTgtODQwZC0wNTJiZmIwODY0ZDM", + "id": "d3934e69-fe90-4958-840d-052bfb0864d3", "last_sent": "", "name": "Email destination - rails_api_base - development", "property": [ @@ -161,13 +244,49 @@ "sensitive_attributes": [], "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 1, + "attributes": { + "account_id": 6572468, + "active": true, + "auth_basic": [], + "auth_custom_header": [], + "auth_token": [], + "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnw3MDNhYjQ3My03NWJmLTQxYTYtODI2NC1iZTVkMGIxNWNjZTU", + "id": "703ab473-75bf-41a6-8264-be5d0b15cce5", + "last_sent": "", + "name": "Email destination - rails_api_base - development2", + "property": [ + { + "display_value": "", + "key": "email", + "label": "", + "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" + }, + { + "display_value": "", + "key": "source", + "label": "terraform-source-internal", + "value": "terraform" + } + ], + "secure_url": [], + "status": "DEFAULT", + "timeouts": null, + "type": "EMAIL" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" } ] }, { "mode": "managed", "type": "newrelic_nrql_alert_condition", - "name": "error_rate", + "name": "error_alert", "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", "instances": [ { @@ -186,32 +305,92 @@ "duration": 0, "operator": "above", "prediction": [], - "threshold": 5, + "threshold": 1, + "threshold_duration": 60, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "Error Alert", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1Nzg4Mzk", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333783:52578839", + "ignore_on_expected_termination": false, + "name": "Error alert - rails_api_base - development", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT count(*) FROM Transaction WHERE error IS true AND appName = 'rails_api_base - development'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333783, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 1, "threshold_duration": 60, "threshold_occurrences": "all", "time_function": "" } ], - "description": "High Error Rate", + "description": "Error Alert", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjI", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1Nzg4NDA", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312903:52400422", + "id": "6333785:52578840", "ignore_on_expected_termination": false, - "name": "High Error Rate - rails_api_base - development", + "name": "Error alert - rails_api_base - development2", "nrql": [ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "SELECT (filter(count(*), WHERE error IS true) / count(*)) * 100 AS 'error_rate' FROM Transaction WHERE appName = 'rails_api_base - development'", + "query": "SELECT count(*) FROM Transaction WHERE error IS true AND appName = 'rails_api_base - development2'", "since_value": "" } ], "open_violation_on_expiration": false, - "policy_id": 6312903, + "policy_id": 6333785, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -262,12 +441,12 @@ ], "description": "Low Throughput", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjA", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzM", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312903:52400420", + "id": "6333783:52578173", "ignore_on_expected_termination": false, "name": "Low Throughput - rails_api_base - development", "nrql": [ @@ -279,7 +458,67 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6312903, + "policy_id": 6333783, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "below", + "prediction": [], + "threshold": 5, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "Low Throughput", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDk", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333785:52578209", + "ignore_on_expected_termination": false, + "name": "Low Throughput - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333785, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -330,12 +569,12 @@ ], "description": "P90 Alert", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjQ", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzI", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312902:52400424", + "id": "6333782:52578172", "ignore_on_expected_termination": false, "name": "P90 Alert - rails_api_base - development", "nrql": [ @@ -347,7 +586,67 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6312902, + "policy_id": 6333782, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.percentiles_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 1.5, + "threshold_duration": 60, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "P90 Alert", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDc", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333784:52578207", + "ignore_on_expected_termination": false, + "name": "P90 Alert - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333784, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -398,12 +697,12 @@ ], "description": "P95 Alert", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjE", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzE", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312902:52400421", + "id": "6333782:52578171", "ignore_on_expected_termination": false, "name": "P95 Alert - rails_api_base - development", "nrql": [ @@ -415,7 +714,67 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6312902, + "policy_id": 6333782, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.percentiles_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 5, + "threshold_duration": 60, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "P95 Alert", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDY", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333784:52578206", + "ignore_on_expected_termination": false, + "name": "P95 Alert - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT percentile(duration, 95) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333784, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -466,12 +825,12 @@ ], "description": "High Transaction Response Time", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI0MDA0MjM", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzQ", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6312903:52400423", + "id": "6333783:52578174", "ignore_on_expected_termination": false, "name": "Response Time - rails_api_base - development", "nrql": [ @@ -483,7 +842,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6312903, + "policy_id": 6333783, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -501,214 +860,73 @@ "dependencies": [ "newrelic_alert_policy.golden_metrics_policy" ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_one_dashboard", - "name": "exampledash", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ + }, { + "index_key": "rails_api_base - development2", "schema_version": 0, "attributes": { "account_id": 6572468, - "description": null, - "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTM4MTQz", - "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTM4MTQz", - "name": "New Relic Terraform Example", - "page": [ - { - "description": "", - "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfDM5MTMwMjc0", - "name": "New Relic Terraform Example", - "widget_area": [], - "widget_bar": [ - { - "colors": [], - "column": 7, - "data_format": [], - "facet_show_other_series": false, - "filter_current_dashboard": false, - "height": 3, - "id": "431615733", - "ignore_time_range": false, - "initial_sorting": [], - "legend_enabled": true, - "linked_entity_guids": [], - "nrql_query": [ - { - "account_id": 6572468, - "query": "FROM Transaction SELECT average(duration) FACET appName" - } - ], - "null_values": [], - "refresh_rate": "", - "row": 1, - "title": "Average transaction duration, by application", - "units": [], - "width": 6, - "y_axis_left_max": 0, - "y_axis_left_min": 0 - } - ], - "widget_billboard": [ - { - "colors": [], - "column": 1, - "critical": "", - "data_format": [ - { - "format": "", - "name": "rate", - "precision": 0, - "type": "recent-relative" - } - ], - "facet_show_other_series": false, - "height": 3, - "id": "431450458", - "ignore_time_range": false, - "initial_sorting": [], - "legend_enabled": true, - "nrql_query": [ - { - "account_id": 6572468, - "query": "FROM Transaction SELECT rate(count(*), 1 minute)" - } - ], - "null_values": [], - "refresh_rate": "60000", - "row": 1, - "title": "Requests per minute", - "units": [], - "warning": "", - "width": 6, - "y_axis_left_max": 0, - "y_axis_left_min": 0 - } - ], - "widget_bullet": [], - "widget_funnel": [], - "widget_heatmap": [], - "widget_histogram": [], - "widget_json": [], - "widget_line": [ - { - "colors": [], - "column": 7, - "data_format": [], - "facet_show_other_series": false, - "height": 3, - "id": "431450649", - "ignore_time_range": false, - "initial_sorting": [], - "is_label_visible": true, - "legend_enabled": true, - "nrql_query": [ - { - "account_id": 6572468, - "query": "FROM Transaction select max(duration) as 'max duration' where httpResponseCode = '504' timeseries since 5 minutes ago" - }, - { - "account_id": 6572468, - "query": "FROM Transaction SELECT rate(count(*), 1 minute)" - } - ], - "null_values": [], - "refresh_rate": "30000", - "row": 4, - "threshold": [ - { - "from": "1", - "name": "Duration Threshold", - "severity": "critical", - "to": "2" - }, - { - "from": "2.1", - "name": "Duration Threshold Two", - "severity": "warning", - "to": "3.3" - } - ], - "title": "Average transaction duration and the request per minute, by application", - "units": [ - { - "series_overrides": [ - { - "series_name": "max duration", - "unit": "ms" - } - ], - "unit": "ms" - } - ], - "width": 6, - "y_axis_left_max": 1, - "y_axis_left_min": 0, - "y_axis_left_zero": true, - "y_axis_right": [ - { - "y_axis_right_max": 300, - "y_axis_right_min": 0, - "y_axis_right_series": [ - "A", - "B" - ], - "y_axis_right_zero": true - } - ] - } - ], - "widget_log_table": [], - "widget_markdown": [], - "widget_pie": [], - "widget_stacked_bar": [], - "widget_table": [] + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 5, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" } ], - "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTM4MTQz", - "permissions": "private", - "variable": [ + "description": "High Transaction Response Time", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDg", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333785:52578208", + "ignore_on_expected_termination": false, + "name": "Response Time - rails_api_base - development2", + "nrql": [ { - "default_values": [ - "value" - ], - "is_multi_selection": true, - "item": [ - { - "title": "item", - "value": "ITEM" - } - ], - "name": "app_name", - "nrql_query": [ - { - "account_ids": [ - 6572468 - ], - "query": "FROM Transaction SELECT distinct(appName)" - } - ], - "options": [], - "replacement_strategy": "default", - "title": "app_name", - "type": "nrql" + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT average(duration) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "since_value": "" } - ] + ], + "open_violation_on_expiration": false, + "policy_id": 6333785, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] }, "sensitive_attributes": [], "identity_schema_version": 0, - "private": "bnVsbA==" + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] } ] }, { "mode": "managed", "type": "newrelic_one_dashboard_json", - "name": "custom_dashboard", + "name": "activerecord_dashboard", "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", "instances": [ { @@ -716,12 +934,28 @@ "schema_version": 0, "attributes": { "account_id": 6572468, - "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTc2OTIy", - "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTc2OTIy", - "json": "{\n \"name\": \"Activerecord - rails_api_base - development\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", - "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMTc2OTIy", + "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", + "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", + "json": "{\n \"name\": \"Activerecord - rails_api_base - development\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Non-Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", + "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", + "timeouts": null, + "updated_at": "2025-06-13T17:36:34.946813Z" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMH19" + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", + "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", + "json": "{\n \"name\": \"Activerecord - rails_api_base - development2\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Non-Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development2' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development2' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development2' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", + "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", "timeouts": null, - "updated_at": "2025-06-11T19:16:27.197462Z" + "updated_at": "2025-06-13T17:36:35.057018Z" }, "sensitive_attributes": [], "identity_schema_version": 0, @@ -742,7 +976,7 @@ "account_id": 6572468, "destination": [ { - "channel_id": "7a447725-2859-440e-89db-4917e732bcf5", + "channel_id": "382405ca-0940-4337-ac0c-436ae392e5eb", "name": "Email channel - rails_api_base - development", "notification_triggers": [ "ACKNOWLEDGED", @@ -757,11 +991,11 @@ "enabled": true, "enrichments": [], "enrichments_enabled": true, - "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3wxZTk5ODNlZS1lOWFiLTQ5MTQtODE3OC02YzM3MTdmMmZkNjk", - "id": "1e9983ee-e9ab-4914-8178-6c3717f2fd69", + "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3xiMzIyOTIxNi0yZTcxLTRmNDktYjMxNi1mN2E3Y2E3OWEwN2Y", + "id": "b3229216-2e71-4f49-b316-f7a7ca79a07f", "issues_filter": [ { - "filter_id": "013df1c2-95f2-49a6-90bc-bcf702fdcde8", + "filter_id": "0ec8020f-7913-4786-a988-8adebf9f9d63", "name": "Filter - rails_api_base - development", "predicate": [ { @@ -776,10 +1010,66 @@ "type": "FILTER" } ], - "last_run": "2025-06-06T18:28:45.660Z", + "last_run": "", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "Workflow - rails_api_base - development", - "workflow_id": "1e9983ee-e9ab-4914-8178-6c3717f2fd69" + "workflow_id": "b3229216-2e71-4f49-b316-f7a7ca79a07f" + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy", + "newrelic_alert_policy.percentiles_policy", + "newrelic_notification_channel.email_channel", + "newrelic_notification_destination.email_destination" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 1, + "attributes": { + "account_id": 6572468, + "destination": [ + { + "channel_id": "c0b3137b-8afd-4aed-821b-92ca7cfa203e", + "name": "Email channel - rails_api_base - development2", + "notification_triggers": [ + "ACKNOWLEDGED", + "ACTIVATED", + "CLOSED" + ], + "type": "EMAIL", + "update_original_message": true + } + ], + "destinations_enabled": true, + "enabled": true, + "enrichments": [], + "enrichments_enabled": true, + "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3xlNjdkNGVhMy1mMTFjLTQwODgtYjJmNi05OWQ2YjNmOTU1NTE", + "id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551", + "issues_filter": [ + { + "filter_id": "1b977d4e-e243-4a82-8d17-da8b039907e9", + "name": "Filter - rails_api_base - development2", + "predicate": [ + { + "attribute": "accumulations.policyName", + "operator": "EXACTLY_MATCHES", + "values": [ + "Golden Signals - rails_api_base - development2", + "Percentiles - rails_api_base - development2" + ] + } + ], + "type": "FILTER" + } + ], + "last_run": "", + "muting_rules_handling": "NOTIFY_ALL_ISSUES", + "name": "Workflow - rails_api_base - development2", + "workflow_id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551" }, "sensitive_attributes": [], "identity_schema_version": 0, From 4cf394de6c6c4d543a287c4cef9dcd1fd6664dd9 Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Wed, 18 Jun 2025 15:58:50 -0300 Subject: [PATCH 10/16] Add new alerts for CPU and memory (untested) --- infra/new_relic/alerts.tf | 46 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 0bd31891..17201626 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -96,7 +96,7 @@ resource "newrelic_nrql_alert_condition" "low_throughput" { violation_time_limit_seconds = 259200 # 3 days nrql { - query = "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = '${each.value}'" + query = "FROM Transaction SELECT count(*) WHERE appName = '${each.value}'" } critical { @@ -129,6 +129,50 @@ resource "newrelic_nrql_alert_condition" "error_alert" { } } +# CPU usage +resource "newrelic_nrql_alert_condition" "cpu_usage" { + for_each = toset(var.app_name) + policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id + type = "static" + name = "CPU Usage - ${each.value}" + description = "CPU Usage" + enabled = true + violation_time_limit_seconds = 259200 # 3 days + + nrql { + query = "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 WHERE appName = '${app_name}'" + } + + critical { + threshold = 90 + threshold_duration = 300 + threshold_occurrences = "ALL" + operator = "above" + } +} + +# Memory usage +resource "newrelic_nrql_alert_condition" "memory_usage" { + for_each = toset(var.app_name) + policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id + type = "static" + name = "Memory Usage - ${each.value}" + description = "Memory Usage" + enabled = true + violation_time_limit_seconds = 259200 # 3 days + + nrql { + query = "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 WHERE appName = '${app_name}'" + } + + critical { + threshold = 90 + threshold_duration = 300 + threshold_occurrences = "ALL" + operator = "above" + } +} + ####################################### # P90 and P95 Alerts # ####################################### From 4eaa16da24d6ab1e77cbb0096ec6fa8066a25687 Mon Sep 17 00:00:00 2001 From: Ignacio Perez Date: Fri, 27 Jun 2025 16:44:51 -0300 Subject: [PATCH 11/16] Add per transaction alerts --- .ruby-version | 2 +- .tool-versions | 1 + app/admin/admin_user.rb | 7 + infra/new_relic/alerts.tf | 91 ++++++------ infra/new_relic/terraform.tfstate | 178 ++++++++++++++++++---- infra/new_relic/terraform.tfstate.backup | 182 +++++++++++++++++++---- 6 files changed, 360 insertions(+), 101 deletions(-) create mode 100644 .tool-versions diff --git a/.ruby-version b/.ruby-version index 4d9d11cf..47b322c9 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.4.2 +3.4.1 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..041df9aa --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.4.1 diff --git a/app/admin/admin_user.rb b/app/admin/admin_user.rb index b8d3d0c3..c8417d3a 100644 --- a/app/admin/admin_user.rb +++ b/app/admin/admin_user.rb @@ -3,6 +3,13 @@ ActiveAdmin.register AdminUser do permit_params :email, :password, :password_confirmation + controller do + def index + sleep 5 + super + end + end + index do selectable_column id_column diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 17201626..98f36b3e 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -64,22 +64,22 @@ resource "newrelic_alert_policy" "percentiles_policy" { } # Response time - Create Alert Condition -resource "newrelic_nrql_alert_condition" "response_time_alert" { +resource "newrelic_nrql_alert_condition" "p90_latency_alert" { for_each = toset(var.app_name) policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id type = "static" - name = "Response Time - ${each.value}" + name = "P90 Response Time - ${each.value}" description = "High Transaction Response Time" enabled = true violation_time_limit_seconds = 259200 # 3 days nrql { - query = "SELECT average(duration) FROM Transaction WHERE appName = '${each.value}'" + query = "SELECT percentile(duration, 90) FROM Transaction WHERE appName = '${each.value}'" } critical { operator = "above" - threshold = 5 + threshold = 1 threshold_duration = 300 threshold_occurrences = "ALL" } @@ -129,50 +129,6 @@ resource "newrelic_nrql_alert_condition" "error_alert" { } } -# CPU usage -resource "newrelic_nrql_alert_condition" "cpu_usage" { - for_each = toset(var.app_name) - policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id - type = "static" - name = "CPU Usage - ${each.value}" - description = "CPU Usage" - enabled = true - violation_time_limit_seconds = 259200 # 3 days - - nrql { - query = "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 WHERE appName = '${app_name}'" - } - - critical { - threshold = 90 - threshold_duration = 300 - threshold_occurrences = "ALL" - operator = "above" - } -} - -# Memory usage -resource "newrelic_nrql_alert_condition" "memory_usage" { - for_each = toset(var.app_name) - policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id - type = "static" - name = "Memory Usage - ${each.value}" - description = "Memory Usage" - enabled = true - violation_time_limit_seconds = 259200 # 3 days - - nrql { - query = "FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 WHERE appName = '${app_name}'" - } - - critical { - threshold = 90 - threshold_duration = 300 - threshold_occurrences = "ALL" - operator = "above" - } -} - ####################################### # P90 and P95 Alerts # ####################################### @@ -265,6 +221,28 @@ resource "newrelic_nrql_alert_condition" "endpoint_p95" { } } +# Generate a P90 alert for each transaction defined in locals.transactions +resource "newrelic_nrql_alert_condition" "transaction_p90_alert" { + for_each = { for t in local.transactions : "${t.app_name}|${t.transaction_name}" => t } + policy_id = newrelic_alert_policy.percentiles_policy[each.value.app_name].id + type = "static" + name = "P90 Alert - ${each.value.app_name} - ${each.value.friendly_name}" + description = "P90 Alert for ${each.value.transaction_name} in ${each.value.app_name}" + enabled = true + violation_time_limit_seconds = 259200 # 3 days + + nrql { + query = "SELECT percentile(duration, 90) FROM Transaction WHERE appName = '${each.value.app_name}' AND name = '${each.value.transaction_name}'" + } + + critical { + threshold = each.value.p90_latency_threshold + threshold_duration = 60 + threshold_occurrences = "ALL" + operator = "above" + } +} + ####################################### # DASHBOARDS # ####################################### @@ -329,3 +307,20 @@ resource "newrelic_workflow" "workflow" { channel_id = newrelic_notification_channel.email_channel[each.value].id } } + +locals { + transactions_per_environment = { + "Admin Users Index" = { + transaction_name = "Controller/admin/admin_users/index" + p90_latency_threshold = 0.2 + } + } + transactions = flatten([ + for app in var.app_name : [ + for t_k, t_v in local.transactions_per_environment : merge({ + app_name = app, + friendly_name = t_k + }, t_v) + ] + ]) +} diff --git a/infra/new_relic/terraform.tfstate b/infra/new_relic/terraform.tfstate index eb01dfd5..d7ad4b31 100644 --- a/infra/new_relic/terraform.tfstate +++ b/infra/new_relic/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.12.2", - "serial": 198, + "serial": 212, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -453,7 +453,7 @@ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development'", + "query": "FROM Transaction SELECT count(*) WHERE appName = 'rails_api_base - development'", "since_value": "" } ], @@ -513,7 +513,7 @@ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development2'", + "query": "FROM Transaction SELECT count(*) WHERE appName = 'rails_api_base - development2'", "since_value": "" } ], @@ -667,6 +667,134 @@ } ] }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "p90_latency_alert", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "index_key": "rails_api_base - development", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 1, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "High Transaction Response Time", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMjE", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333783:52879221", + "ignore_on_expected_termination": false, + "name": "P90 Response Time - rails_api_base - development", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333783, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 1, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "High Transaction Response Time", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMTk", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333785:52879219", + "ignore_on_expected_termination": false, + "name": "P90 Response Time - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333785, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + } + ] + }, { "mode": "managed", "type": "newrelic_nrql_alert_condition", @@ -798,11 +926,11 @@ { "mode": "managed", "type": "newrelic_nrql_alert_condition", - "name": "response_time_alert", + "name": "transaction_p90_alert", "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", "instances": [ { - "index_key": "rails_api_base - development", + "index_key": "rails_api_base - development2|Controller/admin/admin_users/index", "schema_version": 0, "attributes": { "account_id": 6572468, @@ -817,32 +945,32 @@ "duration": 0, "operator": "above", "prediction": [], - "threshold": 5, - "threshold_duration": 300, + "threshold": 0.2, + "threshold_duration": 60, "threshold_occurrences": "all", "time_function": "" } ], - "description": "High Transaction Response Time", + "description": "P90 Alert for Controller/admin/admin_users/index in rails_api_base - development2", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzQ", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkzMjg", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333783:52578174", + "id": "6333784:52879328", "ignore_on_expected_termination": false, - "name": "Response Time - rails_api_base - development", + "name": "P90 Alert - rails_api_base - development2 - Admin Users Index", "nrql": [ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "SELECT average(duration) FROM Transaction WHERE appName = 'rails_api_base - development'", + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2' AND name = 'Controller/admin/admin_users/index'", "since_value": "" } ], "open_violation_on_expiration": false, - "policy_id": 6333783, + "policy_id": 6333784, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -858,11 +986,11 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.percentiles_policy" ] }, { - "index_key": "rails_api_base - development2", + "index_key": "rails_api_base - development|Controller/admin/admin_users/index", "schema_version": 0, "attributes": { "account_id": 6572468, @@ -877,32 +1005,32 @@ "duration": 0, "operator": "above", "prediction": [], - "threshold": 5, - "threshold_duration": 300, + "threshold": 0.2, + "threshold_duration": 60, "threshold_occurrences": "all", "time_function": "" } ], - "description": "High Transaction Response Time", + "description": "P90 Alert for Controller/admin/admin_users/index in rails_api_base - development", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDg", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkzMjc", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333785:52578208", + "id": "6333782:52879327", "ignore_on_expected_termination": false, - "name": "Response Time - rails_api_base - development2", + "name": "P90 Alert - rails_api_base - development - Admin Users Index", "nrql": [ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "SELECT average(duration) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development' AND name = 'Controller/admin/admin_users/index'", "since_value": "" } ], "open_violation_on_expiration": false, - "policy_id": 6333785, + "policy_id": 6333782, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -918,7 +1046,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.percentiles_policy" ] } ] @@ -1066,7 +1194,7 @@ "type": "FILTER" } ], - "last_run": "", + "last_run": "2025-06-27T19:39:40.620Z", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "Workflow - rails_api_base - development2", "workflow_id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551" diff --git a/infra/new_relic/terraform.tfstate.backup b/infra/new_relic/terraform.tfstate.backup index cbccc919..093d1eea 100644 --- a/infra/new_relic/terraform.tfstate.backup +++ b/infra/new_relic/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.12.2", - "serial": 196, + "serial": 207, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -303,7 +303,7 @@ "critical": [ { "duration": 0, - "operator": "above", + "operator": "above_or_equals", "prediction": [], "threshold": 1, "threshold_duration": 60, @@ -363,7 +363,7 @@ "critical": [ { "duration": 0, - "operator": "above", + "operator": "above_or_equals", "prediction": [], "threshold": 1, "threshold_duration": 60, @@ -453,7 +453,7 @@ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development'", + "query": "FROM Transaction SELECT count(*) WHERE appName = 'rails_api_base - development'", "since_value": "" } ], @@ -513,7 +513,7 @@ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "FROM Transaction SELECT rate(count(*), 1 minute) WHERE appName = 'rails_api_base - development2'", + "query": "FROM Transaction SELECT count(*) WHERE appName = 'rails_api_base - development2'", "since_value": "" } ], @@ -667,6 +667,134 @@ } ] }, + { + "mode": "managed", + "type": "newrelic_nrql_alert_condition", + "name": "p90_latency_alert", + "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", + "instances": [ + { + "index_key": "rails_api_base - development", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 1, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "High Transaction Response Time", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMjE", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333783:52879221", + "ignore_on_expected_termination": false, + "name": "P90 Response Time - rails_api_base - development", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333783, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + }, + { + "index_key": "rails_api_base - development2", + "schema_version": 0, + "attributes": { + "account_id": 6572468, + "aggregation_delay": "120", + "aggregation_method": "event_flow", + "aggregation_timer": null, + "aggregation_window": 60, + "baseline_direction": null, + "close_violations_on_expiration": false, + "critical": [ + { + "duration": 0, + "operator": "above", + "prediction": [], + "threshold": 1, + "threshold_duration": 300, + "threshold_occurrences": "all", + "time_function": "" + } + ], + "description": "High Transaction Response Time", + "enabled": true, + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMTk", + "evaluation_delay": null, + "expiration_duration": 0, + "fill_option": "none", + "fill_value": 0, + "id": "6333785:52879219", + "ignore_on_expected_termination": false, + "name": "P90 Response Time - rails_api_base - development2", + "nrql": [ + { + "data_account_id": 6572468, + "evaluation_offset": 0, + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "since_value": "" + } + ], + "open_violation_on_expiration": false, + "policy_id": 6333785, + "runbook_url": "", + "signal_seasonality": null, + "slide_by": null, + "term": [], + "timeouts": null, + "title_template": "", + "type": "static", + "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", + "violation_time_limit_seconds": 259200, + "warning": [] + }, + "sensitive_attributes": [], + "identity_schema_version": 0, + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", + "dependencies": [ + "newrelic_alert_policy.golden_metrics_policy" + ] + } + ] + }, { "mode": "managed", "type": "newrelic_nrql_alert_condition", @@ -798,11 +926,11 @@ { "mode": "managed", "type": "newrelic_nrql_alert_condition", - "name": "response_time_alert", + "name": "transaction_p90", "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", "instances": [ { - "index_key": "rails_api_base - development", + "index_key": "rails_api_base - development2|Controller/admin/users/index", "schema_version": 0, "attributes": { "account_id": 6572468, @@ -817,32 +945,32 @@ "duration": 0, "operator": "above", "prediction": [], - "threshold": 5, - "threshold_duration": 300, + "threshold": 0.2, + "threshold_duration": 60, "threshold_occurrences": "all", "time_function": "" } ], - "description": "High Transaction Response Time", + "description": "P90 Alert for Controller/admin/users/index in rails_api_base - development2", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzQ", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMjA", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333783:52578174", + "id": "6333784:52879220", "ignore_on_expected_termination": false, - "name": "Response Time - rails_api_base - development", + "name": "P90 Alert - rails_api_base - development2 - Admin Users Index", "nrql": [ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "SELECT average(duration) FROM Transaction WHERE appName = 'rails_api_base - development'", + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2' AND name = 'Controller/admin/users/index'", "since_value": "" } ], "open_violation_on_expiration": false, - "policy_id": 6333783, + "policy_id": 6333784, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -858,11 +986,11 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.percentiles_policy" ] }, { - "index_key": "rails_api_base - development2", + "index_key": "rails_api_base - development|Controller/admin/users/index", "schema_version": 0, "attributes": { "account_id": 6572468, @@ -877,32 +1005,32 @@ "duration": 0, "operator": "above", "prediction": [], - "threshold": 5, - "threshold_duration": 300, + "threshold": 0.2, + "threshold_duration": 60, "threshold_occurrences": "all", "time_function": "" } ], - "description": "High Transaction Response Time", + "description": "P90 Alert for Controller/admin/users/index in rails_api_base - development", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDg", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMjI", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333785:52578208", + "id": "6333782:52879222", "ignore_on_expected_termination": false, - "name": "Response Time - rails_api_base - development2", + "name": "P90 Alert - rails_api_base - development - Admin Users Index", "nrql": [ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "SELECT average(duration) FROM Transaction WHERE appName = 'rails_api_base - development2'", + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development' AND name = 'Controller/admin/users/index'", "since_value": "" } ], "open_violation_on_expiration": false, - "policy_id": 6333785, + "policy_id": 6333782, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -918,7 +1046,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.percentiles_policy" ] } ] @@ -1066,7 +1194,7 @@ "type": "FILTER" } ], - "last_run": "", + "last_run": "2025-06-16T18:14:39.317Z", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "Workflow - rails_api_base - development2", "workflow_id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551" From 9dadf1372584b9ac1bef8cb75dabd5ec9c720fa7 Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Wed, 2 Jul 2025 15:45:07 -0300 Subject: [PATCH 12/16] Changes and docs --- bin/bootstrap.sh | 2 +- infra/new_relic/.env.sample | 7 - infra/new_relic/Dockerfile | 16 -- infra/new_relic/README.md | 36 ++- infra/new_relic/alerts.tf | 207 +++++---------- infra/new_relic/terraform.tfstate | 308 ++++++----------------- infra/new_relic/terraform.tfstate.backup | 28 +-- infra/new_relic/variables.tfvars | 4 - 8 files changed, 169 insertions(+), 439 deletions(-) delete mode 100644 infra/new_relic/Dockerfile delete mode 100644 infra/new_relic/variables.tfvars diff --git a/bin/bootstrap.sh b/bin/bootstrap.sh index 1adaabba..3cdcc100 100755 --- a/bin/bootstrap.sh +++ b/bin/bootstrap.sh @@ -71,7 +71,7 @@ sed_i() { export -f sed_i # Define the file types to search for -file_types=("yml" "yaml" "erb" "rb" "json") +file_types=("yml" "yaml" "erb" "rb" "json" "tf") for file_type in "${file_types[@]}" do diff --git a/infra/new_relic/.env.sample b/infra/new_relic/.env.sample index ea13b205..c166ca36 100644 --- a/infra/new_relic/.env.sample +++ b/infra/new_relic/.env.sample @@ -1,10 +1,3 @@ NEW_RELIC_ACCOUNT_ID=1234 NEW_RELIC_API_KEY=NRAK-** NEW_RELIC_REGION=US - -TF_VAR_app_name='["rails_api_base - development"]' - -TF_VAR_endpoints='["/api/v1/users", "/api/v1/orders"]' -# Map of endpoint-specific P95 thresholds (in seconds) to override. -# Not needed if you're ok with the default of 60 seconds. -TF_VAR_endpoint_thresholds='{ "/api/v1/orders": { "p90": 2.0 } }' diff --git a/infra/new_relic/Dockerfile b/infra/new_relic/Dockerfile deleted file mode 100644 index 5af18356..00000000 --- a/infra/new_relic/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM hashicorp/terraform:latest - - -RUN mkdir /app - -WORKDIR /app - -COPY alerts.tf variables.tfvars ./ - -# RUN terraform init - -# RUN terraform plan -out=plan.tfplan - -# RUN terraform apply plan.tfplan - -# ENTRYPOINT [ "/bin/bash" ] diff --git a/infra/new_relic/README.md b/infra/new_relic/README.md index 0d38f2d5..5137775c 100644 --- a/infra/new_relic/README.md +++ b/infra/new_relic/README.md @@ -1,15 +1,33 @@ -## Docker usage +# Installation + +Follow the [Terraform installation docs](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) to install Terraform CLI. + +## Usage + +There are only three commands that need to be run in order to apply this terraform template and fully setup your New Relic monitoring. ```bash -# Build container -docker build -t new-relic-tf . +# Init +terraform init + +# Plan +terraform plan -# Run init command -docker run -v .:/app --env-file .env -it new-relic-tf init +# Apply +terraform apply +``` + +# Docker usage + +If you want to use Docker to avoid installing Terraform, we recommend to use one of the latest versions of the Dockerfile. + +```bash +# Init +docker run -w /app -v .:/app --env-file .env -it hashicorp/terraform:latest init -# Run plan command to verify what is going to change -docker run -v .:/app --env-file .env -it new-relic-tf plan +# Plan +docker run -w /app -v .:/app --env-file .env -it hashicorp/terraform:latest plan -# Apply plan -docker run -v .:/app --env-file .env -it new-relic-tf apply +# Apply +docker run -w /app -v .:/app --env-file .env -it hashicorp/terraform:latest apply ``` \ No newline at end of file diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 98f36b3e..75a57b95 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -9,86 +9,55 @@ terraform { } } -# We use env variables to configure the provider -provider "newrelic" {} - -# Must be an exact match to your application name in New Relic -variable "app_name" { - type = list(string) - description = "List of New Relic application names." - default = [ - "rails_api_base - development" +locals { + transactions_per_environment = { + "Admin Users Index" = { + transaction_name = "Controller/admin/admin_users/index" + p90_latency_threshold = 0.2 + } + } + # Must be an exact match to your application name in New Relic + app_name = "rails_api_base" + # app_environments = ["development", "staging", "production"] + app_environments = ["development", "development2"] + devs_emails = ["julian.pasquale@rootstrap.com", "ignacio.perez@rootstrap.com"] + app_names = [ + for env in local.app_environments : "${local.app_name} - ${env}" ] + transactions = flatten([ + for app in local.app_names : [ + for t_k, t_v in local.transactions_per_environment : merge({ + app_name = app, + friendly_name = t_k + }, t_v) + ] + ]) } +# We use env variables to configure the provider +provider "newrelic" {} + variable "account_id" { type = number description = "New Relic account ID." } -# List of endpoints to monitor for latency -variable "endpoints" { - type = list(string) - description = "List of endpoint URIs to create P95 alert conditions for." - default = [] -} - -# Map of endpoint-specific thresholds (in seconds) -variable "endpoint_thresholds" { - type = map(object({ - p90 = optional(number) - p95 = optional(number) - })) - description = "Map of endpoint URIs to custom P90/P95 thresholds. If not set, uses default threshold." - default = { - "/api/v1/orders" = { p90 = 2.0, p95 = 3.0 } - "/api/v1/users" = { p90 = 1.5 } # Only override P90, use default for P95 - } -} - data "newrelic_entity" "app" { - for_each = toset(var.app_name) + for_each = toset(local.app_names) name = each.value domain = "APM" type = "APPLICATION" } -resource "newrelic_alert_policy" "golden_metrics_policy" { - for_each = toset(var.app_name) - name = "Golden Signals - ${each.value}" -} - -resource "newrelic_alert_policy" "percentiles_policy" { - for_each = toset(var.app_name) - name = "Percentiles - ${each.value}" -} - -# Response time - Create Alert Condition -resource "newrelic_nrql_alert_condition" "p90_latency_alert" { - for_each = toset(var.app_name) - policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id - type = "static" - name = "P90 Response Time - ${each.value}" - description = "High Transaction Response Time" - enabled = true - violation_time_limit_seconds = 259200 # 3 days - - nrql { - query = "SELECT percentile(duration, 90) FROM Transaction WHERE appName = '${each.value}'" - } - - critical { - operator = "above" - threshold = 1 - threshold_duration = 300 - threshold_occurrences = "ALL" - } +resource "newrelic_alert_policy" "rails_app_policy" { + for_each = toset(local.app_names) + name = "Rails app policy - ${each.value}" } # Throughput condition resource "newrelic_nrql_alert_condition" "low_throughput" { - for_each = toset(var.app_name) - policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id + for_each = toset(local.app_names) + policy_id = newrelic_alert_policy.rails_app_policy[each.value].id type = "static" name = "Low Throughput - ${each.value}" description = "Low Throughput" @@ -109,8 +78,8 @@ resource "newrelic_nrql_alert_condition" "low_throughput" { # Error rate condition resource "newrelic_nrql_alert_condition" "error_alert" { - for_each = toset(var.app_name) - policy_id = newrelic_alert_policy.golden_metrics_policy[each.value].id + for_each = toset(local.app_names) + policy_id = newrelic_alert_policy.rails_app_policy[each.value].id type = "static" name = "Error alert - ${each.value}" description = "Error Alert" @@ -134,12 +103,12 @@ resource "newrelic_nrql_alert_condition" "error_alert" { ####################################### # Global P90 Alert -resource "newrelic_nrql_alert_condition" "p90_alert" { - for_each = toset(var.app_name) - policy_id = newrelic_alert_policy.percentiles_policy[each.value].id +resource "newrelic_nrql_alert_condition" "p90_latency_alert" { + for_each = toset(local.app_names) + policy_id = newrelic_alert_policy.rails_app_policy[each.value].id type = "static" - name = "P90 Alert - ${each.value}" - description = "P90 Alert" + name = "P90 Response Time - ${each.value}" + description = "High P90 Response Time" enabled = true violation_time_limit_seconds = 259200 # 3 days @@ -148,20 +117,20 @@ resource "newrelic_nrql_alert_condition" "p90_alert" { } critical { - threshold = 1.5 # Recommended starting value, see below - threshold_duration = 60 - threshold_occurrences = "ALL" operator = "above" + threshold = 1 + threshold_duration = 300 + threshold_occurrences = "ALL" } } # Global P95 Alert resource "newrelic_nrql_alert_condition" "p95_alert" { - for_each = toset(var.app_name) - policy_id = newrelic_alert_policy.percentiles_policy[each.value].id + for_each = toset(local.app_names) + policy_id = newrelic_alert_policy.rails_app_policy[each.value].id type = "static" - name = "P95 Alert - ${each.value}" - description = "P95 Alert" + name = "P95 Response Time - ${each.value}" + description = "High P95 Response Time" enabled = true violation_time_limit_seconds = 259200 # 3 days @@ -170,52 +139,8 @@ resource "newrelic_nrql_alert_condition" "p95_alert" { } critical { - threshold = 5 - threshold_duration = 60 - threshold_occurrences = "ALL" - operator = "above" - } -} - -# Per-endpoint P90 Alert -resource "newrelic_nrql_alert_condition" "endpoint_p90" { - for_each = { for pair in flatten([for app in var.app_name : [for endpoint in var.endpoints : { app = app, endpoint = endpoint }]]) : "${pair.app}|${pair.endpoint}" => pair } - policy_id = newrelic_alert_policy.percentiles_policy[each.value.app].id - type = "static" - name = "P90 Alert - ${each.value.app} - ${each.value.endpoint}" - description = "P90 Alert for endpoint ${each.value.endpoint}" - enabled = true - violation_time_limit_seconds = 259200 # 3 days - - nrql { - query = "SELECT percentile(duration, 90) FROM Transaction WHERE appName = '${each.value.app}' AND request.uri = '${each.value.endpoint}'" - } - - critical { - threshold = lookup(try(var.endpoint_thresholds[each.value.endpoint].p90, null), each.value.endpoint, 1.5) - threshold_duration = 60 - threshold_occurrences = "ALL" - operator = "above" - } -} - -# Per-endpoint P95 Alert -resource "newrelic_nrql_alert_condition" "endpoint_p95" { - for_each = { for pair in flatten([for app in var.app_name : [for endpoint in var.endpoints : { app = app, endpoint = endpoint }]]) : "${pair.app}|${pair.endpoint}" => pair } - policy_id = newrelic_alert_policy.percentiles_policy[each.value.app].id - type = "static" - name = "P95 Alert - ${each.value.app} - ${each.value.endpoint}" - description = "P95 Alert for endpoint ${each.value.endpoint}" - enabled = true - violation_time_limit_seconds = 259200 # 3 days - - nrql { - query = "SELECT percentile(duration, 95) FROM Transaction WHERE appName = '${each.value.app}' AND request.uri = '${each.value.endpoint}'" - } - - critical { - threshold = lookup(try(var.endpoint_thresholds[each.value.endpoint].p95, null), each.value.endpoint, 2.5) - threshold_duration = 60 + threshold = 1 + threshold_duration = 300 threshold_occurrences = "ALL" operator = "above" } @@ -224,10 +149,10 @@ resource "newrelic_nrql_alert_condition" "endpoint_p95" { # Generate a P90 alert for each transaction defined in locals.transactions resource "newrelic_nrql_alert_condition" "transaction_p90_alert" { for_each = { for t in local.transactions : "${t.app_name}|${t.transaction_name}" => t } - policy_id = newrelic_alert_policy.percentiles_policy[each.value.app_name].id + policy_id = newrelic_alert_policy.rails_app_policy[each.value.app_name].id type = "static" - name = "P90 Alert - ${each.value.app_name} - ${each.value.friendly_name}" - description = "P90 Alert for ${each.value.transaction_name} in ${each.value.app_name}" + name = "P90 Alert on ${each.value.friendly_name} - ${each.value.app_name}" + description = "P90 Alert on ${each.value.transaction_name} in ${each.value.app_name}" enabled = true violation_time_limit_seconds = 259200 # 3 days @@ -237,7 +162,7 @@ resource "newrelic_nrql_alert_condition" "transaction_p90_alert" { critical { threshold = each.value.p90_latency_threshold - threshold_duration = 60 + threshold_duration = 300 threshold_occurrences = "ALL" operator = "above" } @@ -248,7 +173,7 @@ resource "newrelic_nrql_alert_condition" "transaction_p90_alert" { ####################################### resource "newrelic_one_dashboard_json" "activerecord_dashboard" { - for_each = toset(var.app_name) + for_each = toset(local.app_names) json = templatefile("${path.module}/dashboard.json.tftpl", { app_name = each.value, account_id = var.account_id @@ -260,18 +185,18 @@ resource "newrelic_one_dashboard_json" "activerecord_dashboard" { ####################################### resource "newrelic_notification_destination" "email_destination" { - for_each = toset(var.app_name) + for_each = toset(local.app_names) name = "Email destination - ${each.value}" type = "EMAIL" property { key = "email" - value = "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" + value = join(",", local.devs_emails) } } resource "newrelic_notification_channel" "email_channel" { - for_each = toset(var.app_name) + for_each = toset(local.app_names) name = "Email channel - ${each.value}" type = "EMAIL" destination_id = newrelic_notification_destination.email_destination[each.value].id @@ -284,7 +209,7 @@ resource "newrelic_notification_channel" "email_channel" { } resource "newrelic_workflow" "workflow" { - for_each = toset(var.app_name) + for_each = toset(local.app_names) name = "Workflow - ${each.value}" enabled = true muting_rules_handling = "NOTIFY_ALL_ISSUES" @@ -297,8 +222,7 @@ resource "newrelic_workflow" "workflow" { attribute = "accumulations.policyName" operator = "EXACTLY_MATCHES" values = [ - newrelic_alert_policy.golden_metrics_policy[each.value].name, - newrelic_alert_policy.percentiles_policy[each.value].name + newrelic_alert_policy.rails_app_policy[each.value].name ] } } @@ -307,20 +231,3 @@ resource "newrelic_workflow" "workflow" { channel_id = newrelic_notification_channel.email_channel[each.value].id } } - -locals { - transactions_per_environment = { - "Admin Users Index" = { - transaction_name = "Controller/admin/admin_users/index" - p90_latency_threshold = 0.2 - } - } - transactions = flatten([ - for app in var.app_name : [ - for t_k, t_v in local.transactions_per_environment : merge({ - app_name = app, - friendly_name = t_k - }, t_v) - ] - ]) -} diff --git a/infra/new_relic/terraform.tfstate b/infra/new_relic/terraform.tfstate index d7ad4b31..fed5eaff 100644 --- a/infra/new_relic/terraform.tfstate +++ b/infra/new_relic/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, - "terraform_version": "1.12.2", - "serial": 212, + "terraform_version": "1.12.1", + "serial": 243, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -18,7 +18,7 @@ "account_id": 6572468, "application_id": 515583865, "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", "ignore_case": false, @@ -38,7 +38,7 @@ "account_id": 6572468, "application_id": 524986998, "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", + "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", "ignore_case": false, @@ -56,43 +56,7 @@ { "mode": "managed", "type": "newrelic_alert_policy", - "name": "golden_metrics_policy", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6333783", - "incident_preference": "PER_POLICY", - "name": "Golden Signals - rails_api_base - development" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "bnVsbA==" - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6333785", - "incident_preference": "PER_POLICY", - "name": "Golden Signals - rails_api_base - development2" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "bnVsbA==" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_alert_policy", - "name": "percentiles_policy", + "name": "rails_app_policy", "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", "instances": [ { @@ -101,9 +65,9 @@ "attributes": { "account_id": 6572468, "channel_ids": null, - "id": "6333782", + "id": "6376656", "incident_preference": "PER_POLICY", - "name": "Percentiles - rails_api_base - development" + "name": "Rails app policy - rails_api_base - development" }, "sensitive_attributes": [], "identity_schema_version": 0, @@ -115,9 +79,9 @@ "attributes": { "account_id": 6572468, "channel_ids": null, - "id": "6333784", + "id": "6376655", "incident_preference": "PER_POLICY", - "name": "Percentiles - rails_api_base - development2" + "name": "Rails app policy - rails_api_base - development2" }, "sensitive_attributes": [], "identity_schema_version": 0, @@ -313,12 +277,12 @@ ], "description": "Error Alert", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1Nzg4Mzk", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDE", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333783:52578839", + "id": "6376656:52980101", "ignore_on_expected_termination": false, "name": "Error alert - rails_api_base - development", "nrql": [ @@ -330,7 +294,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333783, + "policy_id": 6376656, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -346,7 +310,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.rails_app_policy" ] }, { @@ -373,12 +337,12 @@ ], "description": "Error Alert", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1Nzg4NDA", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDU", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333785:52578840", + "id": "6376655:52980105", "ignore_on_expected_termination": false, "name": "Error alert - rails_api_base - development2", "nrql": [ @@ -390,7 +354,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333785, + "policy_id": 6376655, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -406,7 +370,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.rails_app_policy" ] } ] @@ -441,12 +405,12 @@ ], "description": "Low Throughput", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzM", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDI", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333783:52578173", + "id": "6376656:52980102", "ignore_on_expected_termination": false, "name": "Low Throughput - rails_api_base - development", "nrql": [ @@ -458,7 +422,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333783, + "policy_id": 6376656, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -474,7 +438,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.rails_app_policy" ] }, { @@ -501,12 +465,12 @@ ], "description": "Low Throughput", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDk", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDQ", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333785:52578209", + "id": "6376655:52980104", "ignore_on_expected_termination": false, "name": "Low Throughput - rails_api_base - development2", "nrql": [ @@ -518,75 +482,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333785, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "p90_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1.5, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P90 Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzI", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333782:52578172", - "ignore_on_expected_termination": false, - "name": "P90 Alert - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333782, + "policy_id": 6376655, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -602,67 +498,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.percentiles_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1.5, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P90 Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDc", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333784:52578207", - "ignore_on_expected_termination": false, - "name": "P90 Alert - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333784, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.percentiles_policy" + "newrelic_alert_policy.rails_app_policy" ] } ] @@ -695,14 +531,14 @@ "time_function": "" } ], - "description": "High Transaction Response Time", + "description": "High P90 Response Time", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMjE", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDM", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333783:52879221", + "id": "6376656:52980103", "ignore_on_expected_termination": false, "name": "P90 Response Time - rails_api_base - development", "nrql": [ @@ -714,7 +550,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333783, + "policy_id": 6376656, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -730,7 +566,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.rails_app_policy" ] }, { @@ -755,14 +591,14 @@ "time_function": "" } ], - "description": "High Transaction Response Time", + "description": "High P90 Response Time", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMTk", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDA", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333785:52879219", + "id": "6376655:52980100", "ignore_on_expected_termination": false, "name": "P90 Response Time - rails_api_base - development2", "nrql": [ @@ -774,7 +610,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333785, + "policy_id": 6376655, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -790,7 +626,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" + "newrelic_alert_policy.rails_app_policy" ] } ] @@ -817,22 +653,22 @@ "duration": 0, "operator": "above", "prediction": [], - "threshold": 5, - "threshold_duration": 60, + "threshold": 1, + "threshold_duration": 300, "threshold_occurrences": "all", "time_function": "" } ], - "description": "P95 Alert", + "description": "High P95 Response Time", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzE", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAwOTk", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333782:52578171", + "id": "6376656:52980099", "ignore_on_expected_termination": false, - "name": "P95 Alert - rails_api_base - development", + "name": "P95 Response Time - rails_api_base - development", "nrql": [ { "data_account_id": 6572468, @@ -842,7 +678,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333782, + "policy_id": 6376656, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -858,7 +694,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.percentiles_policy" + "newrelic_alert_policy.rails_app_policy" ] }, { @@ -877,22 +713,22 @@ "duration": 0, "operator": "above", "prediction": [], - "threshold": 5, - "threshold_duration": 60, + "threshold": 1, + "threshold_duration": 300, "threshold_occurrences": "all", "time_function": "" } ], - "description": "P95 Alert", + "description": "High P95 Response Time", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDY", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAwOTY", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333784:52578206", + "id": "6376655:52980096", "ignore_on_expected_termination": false, - "name": "P95 Alert - rails_api_base - development2", + "name": "P95 Response Time - rails_api_base - development2", "nrql": [ { "data_account_id": 6572468, @@ -902,7 +738,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333784, + "policy_id": 6376655, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -918,7 +754,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.percentiles_policy" + "newrelic_alert_policy.rails_app_policy" ] } ] @@ -946,21 +782,21 @@ "operator": "above", "prediction": [], "threshold": 0.2, - "threshold_duration": 60, + "threshold_duration": 300, "threshold_occurrences": "all", "time_function": "" } ], - "description": "P90 Alert for Controller/admin/admin_users/index in rails_api_base - development2", + "description": "P90 Alert on Controller/admin/admin_users/index in rails_api_base - development2", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkzMjg", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAwOTc", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333784:52879328", + "id": "6376655:52980097", "ignore_on_expected_termination": false, - "name": "P90 Alert - rails_api_base - development2 - Admin Users Index", + "name": "P90 Alert on Admin Users Index - rails_api_base - development2", "nrql": [ { "data_account_id": 6572468, @@ -970,7 +806,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333784, + "policy_id": 6376655, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -986,7 +822,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.percentiles_policy" + "newrelic_alert_policy.rails_app_policy" ] }, { @@ -1006,21 +842,21 @@ "operator": "above", "prediction": [], "threshold": 0.2, - "threshold_duration": 60, + "threshold_duration": 300, "threshold_occurrences": "all", "time_function": "" } ], - "description": "P90 Alert for Controller/admin/admin_users/index in rails_api_base - development", + "description": "P90 Alert on Controller/admin/admin_users/index in rails_api_base - development", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkzMjc", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAwOTg", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333782:52879327", + "id": "6376656:52980098", "ignore_on_expected_termination": false, - "name": "P90 Alert - rails_api_base - development - Admin Users Index", + "name": "P90 Alert on Admin Users Index - rails_api_base - development", "nrql": [ { "data_account_id": 6572468, @@ -1030,7 +866,7 @@ } ], "open_violation_on_expiration": false, - "policy_id": 6333782, + "policy_id": 6376656, "runbook_url": "", "signal_seasonality": null, "slide_by": null, @@ -1046,7 +882,7 @@ "identity_schema_version": 0, "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", "dependencies": [ - "newrelic_alert_policy.percentiles_policy" + "newrelic_alert_policy.rails_app_policy" ] } ] @@ -1130,8 +966,7 @@ "attribute": "accumulations.policyName", "operator": "EXACTLY_MATCHES", "values": [ - "Golden Signals - rails_api_base - development", - "Percentiles - rails_api_base - development" + "Rails app policy - rails_api_base - development" ] } ], @@ -1147,8 +982,7 @@ "identity_schema_version": 0, "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy", - "newrelic_alert_policy.percentiles_policy", + "newrelic_alert_policy.rails_app_policy", "newrelic_notification_channel.email_channel", "newrelic_notification_destination.email_destination" ] @@ -1186,15 +1020,14 @@ "attribute": "accumulations.policyName", "operator": "EXACTLY_MATCHES", "values": [ - "Golden Signals - rails_api_base - development2", - "Percentiles - rails_api_base - development2" + "Rails app policy - rails_api_base - development2" ] } ], "type": "FILTER" } ], - "last_run": "2025-06-27T19:39:40.620Z", + "last_run": "2025-06-30T19:40:00.391Z", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "Workflow - rails_api_base - development2", "workflow_id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551" @@ -1203,8 +1036,7 @@ "identity_schema_version": 0, "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy", - "newrelic_alert_policy.percentiles_policy", + "newrelic_alert_policy.rails_app_policy", "newrelic_notification_channel.email_channel", "newrelic_notification_destination.email_destination" ] diff --git a/infra/new_relic/terraform.tfstate.backup b/infra/new_relic/terraform.tfstate.backup index 093d1eea..4c10c28e 100644 --- a/infra/new_relic/terraform.tfstate.backup +++ b/infra/new_relic/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, - "terraform_version": "1.12.2", - "serial": 207, + "terraform_version": "1.12.1", + "serial": 212, "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", "outputs": {}, "resources": [ @@ -926,11 +926,11 @@ { "mode": "managed", "type": "newrelic_nrql_alert_condition", - "name": "transaction_p90", + "name": "transaction_p90_alert", "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", "instances": [ { - "index_key": "rails_api_base - development2|Controller/admin/users/index", + "index_key": "rails_api_base - development2|Controller/admin/admin_users/index", "schema_version": 0, "attributes": { "account_id": 6572468, @@ -951,21 +951,21 @@ "time_function": "" } ], - "description": "P90 Alert for Controller/admin/users/index in rails_api_base - development2", + "description": "P90 Alert for Controller/admin/admin_users/index in rails_api_base - development2", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMjA", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkzMjg", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333784:52879220", + "id": "6333784:52879328", "ignore_on_expected_termination": false, "name": "P90 Alert - rails_api_base - development2 - Admin Users Index", "nrql": [ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2' AND name = 'Controller/admin/users/index'", + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2' AND name = 'Controller/admin/admin_users/index'", "since_value": "" } ], @@ -990,7 +990,7 @@ ] }, { - "index_key": "rails_api_base - development|Controller/admin/users/index", + "index_key": "rails_api_base - development|Controller/admin/admin_users/index", "schema_version": 0, "attributes": { "account_id": 6572468, @@ -1011,21 +1011,21 @@ "time_function": "" } ], - "description": "P90 Alert for Controller/admin/users/index in rails_api_base - development", + "description": "P90 Alert for Controller/admin/admin_users/index in rails_api_base - development", "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMjI", + "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkzMjc", "evaluation_delay": null, "expiration_duration": 0, "fill_option": "none", "fill_value": 0, - "id": "6333782:52879222", + "id": "6333782:52879327", "ignore_on_expected_termination": false, "name": "P90 Alert - rails_api_base - development - Admin Users Index", "nrql": [ { "data_account_id": 6572468, "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development' AND name = 'Controller/admin/users/index'", + "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development' AND name = 'Controller/admin/admin_users/index'", "since_value": "" } ], @@ -1194,7 +1194,7 @@ "type": "FILTER" } ], - "last_run": "2025-06-16T18:14:39.317Z", + "last_run": "2025-06-27T19:39:40.620Z", "muting_rules_handling": "NOTIFY_ALL_ISSUES", "name": "Workflow - rails_api_base - development2", "workflow_id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551" diff --git a/infra/new_relic/variables.tfvars b/infra/new_relic/variables.tfvars deleted file mode 100644 index c64885a4..00000000 --- a/infra/new_relic/variables.tfvars +++ /dev/null @@ -1,4 +0,0 @@ -newrelic_account_id = "" -newrelic_api_key = "" -newrelic_region = "US" -app_name = "rails_api_base" From 1936c659de51195c40be6379e5716b74140f35a0 Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Wed, 2 Jul 2025 15:47:13 -0300 Subject: [PATCH 13/16] Cleanup --- infra/new_relic/alerts.tf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/alerts.tf index 75a57b95..42fc5b84 100644 --- a/infra/new_relic/alerts.tf +++ b/infra/new_relic/alerts.tf @@ -18,9 +18,8 @@ locals { } # Must be an exact match to your application name in New Relic app_name = "rails_api_base" - # app_environments = ["development", "staging", "production"] - app_environments = ["development", "development2"] - devs_emails = ["julian.pasquale@rootstrap.com", "ignacio.perez@rootstrap.com"] + app_environments = ["development", "staging", "production"] + devs_emails = ["devs@example.com"] app_names = [ for env in local.app_environments : "${local.app_name} - ${env}" ] From 6d005209cf78ed235d4d4674b9116f60423df243 Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Wed, 2 Jul 2025 15:52:27 -0300 Subject: [PATCH 14/16] Cleanup --- .ruby-version | 2 +- .tool-versions | 1 - app/admin/admin_user.rb | 7 - app/admin/user.rb | 6 - config/newrelic.yml | 2 +- infra/new_relic/{alerts.tf => main.tf} | 0 infra/new_relic/terraform.tfstate | 1048 ------------------- infra/new_relic/terraform.tfstate.backup | 1216 ---------------------- 8 files changed, 2 insertions(+), 2280 deletions(-) delete mode 100644 .tool-versions rename infra/new_relic/{alerts.tf => main.tf} (100%) delete mode 100644 infra/new_relic/terraform.tfstate delete mode 100644 infra/new_relic/terraform.tfstate.backup diff --git a/.ruby-version b/.ruby-version index 47b322c9..4d9d11cf 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.4.1 +3.4.2 diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index 041df9aa..00000000 --- a/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -ruby 3.4.1 diff --git a/app/admin/admin_user.rb b/app/admin/admin_user.rb index c8417d3a..b8d3d0c3 100644 --- a/app/admin/admin_user.rb +++ b/app/admin/admin_user.rb @@ -3,13 +3,6 @@ ActiveAdmin.register AdminUser do permit_params :email, :password, :password_confirmation - controller do - def index - sleep 5 - super - end - end - index do selectable_column id_column diff --git a/app/admin/user.rb b/app/admin/user.rb index 7451f9a0..9778d093 100644 --- a/app/admin/user.rb +++ b/app/admin/user.rb @@ -69,10 +69,4 @@ target: '_blank', rel: 'noopener' end end - - controller do - def index - raise 'test' - end - end end diff --git a/config/newrelic.yml b/config/newrelic.yml index a7fd2184..ccc3daa3 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -30,7 +30,7 @@ common: &default_settings development: <<: *default_settings # Do not track the development environment by default. - monitor_mode: true + monitor_mode: false test: <<: *default_settings diff --git a/infra/new_relic/alerts.tf b/infra/new_relic/main.tf similarity index 100% rename from infra/new_relic/alerts.tf rename to infra/new_relic/main.tf diff --git a/infra/new_relic/terraform.tfstate b/infra/new_relic/terraform.tfstate deleted file mode 100644 index fed5eaff..00000000 --- a/infra/new_relic/terraform.tfstate +++ /dev/null @@ -1,1048 +0,0 @@ -{ - "version": 4, - "terraform_version": "1.12.1", - "serial": 243, - "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", - "outputs": {}, - "resources": [ - { - "mode": "data", - "type": "newrelic_entity", - "name": "app", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "application_id": 515583865, - "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", - "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", - "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", - "ignore_case": false, - "ignore_not_found": false, - "name": "rails_api_base - development", - "serving_apm_application_id": null, - "tag": null, - "type": "APPLICATION" - }, - "sensitive_attributes": [], - "identity_schema_version": 0 - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "application_id": 524986998, - "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", - "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", - "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", - "ignore_case": false, - "ignore_not_found": false, - "name": "rails_api_base - development2", - "serving_apm_application_id": null, - "tag": null, - "type": "APPLICATION" - }, - "sensitive_attributes": [], - "identity_schema_version": 0 - } - ] - }, - { - "mode": "managed", - "type": "newrelic_alert_policy", - "name": "rails_app_policy", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6376656", - "incident_preference": "PER_POLICY", - "name": "Rails app policy - rails_api_base - development" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "bnVsbA==" - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6376655", - "incident_preference": "PER_POLICY", - "name": "Rails app policy - rails_api_base - development2" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "bnVsbA==" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_notification_channel", - "name": "email_channel", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "active": true, - "destination_id": "d3934e69-fe90-4958-840d-052bfb0864d3", - "id": "382405ca-0940-4337-ac0c-436ae392e5eb", - "name": "Email channel - rails_api_base - development", - "product": "IINT", - "property": [ - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - }, - { - "display_value": "", - "key": "subject", - "label": "", - "value": "New Alert" - } - ], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_notification_destination.email_destination" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "active": true, - "destination_id": "703ab473-75bf-41a6-8264-be5d0b15cce5", - "id": "c0b3137b-8afd-4aed-821b-92ca7cfa203e", - "name": "Email channel - rails_api_base - development2", - "product": "IINT", - "property": [ - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - }, - { - "display_value": "", - "key": "subject", - "label": "", - "value": "New Alert" - } - ], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_notification_destination.email_destination" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_notification_destination", - "name": "email_destination", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "active": true, - "auth_basic": [], - "auth_custom_header": [], - "auth_token": [], - "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnxkMzkzNGU2OS1mZTkwLTQ5NTgtODQwZC0wNTJiZmIwODY0ZDM", - "id": "d3934e69-fe90-4958-840d-052bfb0864d3", - "last_sent": "", - "name": "Email destination - rails_api_base - development", - "property": [ - { - "display_value": "", - "key": "email", - "label": "", - "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" - }, - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - } - ], - "secure_url": [], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "active": true, - "auth_basic": [], - "auth_custom_header": [], - "auth_token": [], - "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnw3MDNhYjQ3My03NWJmLTQxYTYtODI2NC1iZTVkMGIxNWNjZTU", - "id": "703ab473-75bf-41a6-8264-be5d0b15cce5", - "last_sent": "", - "name": "Email destination - rails_api_base - development2", - "property": [ - { - "display_value": "", - "key": "email", - "label": "", - "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" - }, - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - } - ], - "secure_url": [], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "error_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above_or_equals", - "prediction": [], - "threshold": 1, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "Error Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDE", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376656:52980101", - "ignore_on_expected_termination": false, - "name": "Error alert - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT count(*) FROM Transaction WHERE error IS true AND appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376656, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above_or_equals", - "prediction": [], - "threshold": 1, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "Error Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDU", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376655:52980105", - "ignore_on_expected_termination": false, - "name": "Error alert - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT count(*) FROM Transaction WHERE error IS true AND appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376655, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "low_throughput", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "below", - "prediction": [], - "threshold": 5, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "Low Throughput", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDI", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376656:52980102", - "ignore_on_expected_termination": false, - "name": "Low Throughput - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "FROM Transaction SELECT count(*) WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376656, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "below", - "prediction": [], - "threshold": 5, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "Low Throughput", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDQ", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376655:52980104", - "ignore_on_expected_termination": false, - "name": "Low Throughput - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "FROM Transaction SELECT count(*) WHERE appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376655, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "p90_latency_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "High P90 Response Time", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDM", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376656:52980103", - "ignore_on_expected_termination": false, - "name": "P90 Response Time - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376656, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "High P90 Response Time", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAxMDA", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376655:52980100", - "ignore_on_expected_termination": false, - "name": "P90 Response Time - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376655, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "p95_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "High P95 Response Time", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAwOTk", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376656:52980099", - "ignore_on_expected_termination": false, - "name": "P95 Response Time - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 95) FROM Transaction WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376656, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "High P95 Response Time", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAwOTY", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376655:52980096", - "ignore_on_expected_termination": false, - "name": "P95 Response Time - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 95) FROM Transaction WHERE appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376655, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "transaction_p90_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development2|Controller/admin/admin_users/index", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 0.2, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P90 Alert on Controller/admin/admin_users/index in rails_api_base - development2", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAwOTc", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376655:52980097", - "ignore_on_expected_termination": false, - "name": "P90 Alert on Admin Users Index - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2' AND name = 'Controller/admin/admin_users/index'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376655, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - }, - { - "index_key": "rails_api_base - development|Controller/admin/admin_users/index", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 0.2, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P90 Alert on Controller/admin/admin_users/index in rails_api_base - development", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI5ODAwOTg", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6376656:52980098", - "ignore_on_expected_termination": false, - "name": "P90 Alert on Admin Users Index - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development' AND name = 'Controller/admin/admin_users/index'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6376656, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_one_dashboard_json", - "name": "activerecord_dashboard", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", - "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", - "json": "{\n \"name\": \"Activerecord - rails_api_base - development\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Non-Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", - "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", - "timeouts": null, - "updated_at": "2025-06-13T17:36:34.946813Z" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMH19" - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", - "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", - "json": "{\n \"name\": \"Activerecord - rails_api_base - development2\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Non-Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development2' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development2' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development2' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", - "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", - "timeouts": null, - "updated_at": "2025-06-13T17:36:35.057018Z" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMH19" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_workflow", - "name": "workflow", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "destination": [ - { - "channel_id": "382405ca-0940-4337-ac0c-436ae392e5eb", - "name": "Email channel - rails_api_base - development", - "notification_triggers": [ - "ACKNOWLEDGED", - "ACTIVATED", - "CLOSED" - ], - "type": "EMAIL", - "update_original_message": true - } - ], - "destinations_enabled": true, - "enabled": true, - "enrichments": [], - "enrichments_enabled": true, - "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3xiMzIyOTIxNi0yZTcxLTRmNDktYjMxNi1mN2E3Y2E3OWEwN2Y", - "id": "b3229216-2e71-4f49-b316-f7a7ca79a07f", - "issues_filter": [ - { - "filter_id": "0ec8020f-7913-4786-a988-8adebf9f9d63", - "name": "Filter - rails_api_base - development", - "predicate": [ - { - "attribute": "accumulations.policyName", - "operator": "EXACTLY_MATCHES", - "values": [ - "Rails app policy - rails_api_base - development" - ] - } - ], - "type": "FILTER" - } - ], - "last_run": "", - "muting_rules_handling": "NOTIFY_ALL_ISSUES", - "name": "Workflow - rails_api_base - development", - "workflow_id": "b3229216-2e71-4f49-b316-f7a7ca79a07f" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy", - "newrelic_notification_channel.email_channel", - "newrelic_notification_destination.email_destination" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "destination": [ - { - "channel_id": "c0b3137b-8afd-4aed-821b-92ca7cfa203e", - "name": "Email channel - rails_api_base - development2", - "notification_triggers": [ - "ACKNOWLEDGED", - "ACTIVATED", - "CLOSED" - ], - "type": "EMAIL", - "update_original_message": true - } - ], - "destinations_enabled": true, - "enabled": true, - "enrichments": [], - "enrichments_enabled": true, - "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3xlNjdkNGVhMy1mMTFjLTQwODgtYjJmNi05OWQ2YjNmOTU1NTE", - "id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551", - "issues_filter": [ - { - "filter_id": "1b977d4e-e243-4a82-8d17-da8b039907e9", - "name": "Filter - rails_api_base - development2", - "predicate": [ - { - "attribute": "accumulations.policyName", - "operator": "EXACTLY_MATCHES", - "values": [ - "Rails app policy - rails_api_base - development2" - ] - } - ], - "type": "FILTER" - } - ], - "last_run": "2025-06-30T19:40:00.391Z", - "muting_rules_handling": "NOTIFY_ALL_ISSUES", - "name": "Workflow - rails_api_base - development2", - "workflow_id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", - "dependencies": [ - "newrelic_alert_policy.rails_app_policy", - "newrelic_notification_channel.email_channel", - "newrelic_notification_destination.email_destination" - ] - } - ] - } - ], - "check_results": null -} diff --git a/infra/new_relic/terraform.tfstate.backup b/infra/new_relic/terraform.tfstate.backup deleted file mode 100644 index 4c10c28e..00000000 --- a/infra/new_relic/terraform.tfstate.backup +++ /dev/null @@ -1,1216 +0,0 @@ -{ - "version": 4, - "terraform_version": "1.12.1", - "serial": 212, - "lineage": "22460922-0aeb-b779-b4e7-dd63dffbffaa", - "outputs": {}, - "resources": [ - { - "mode": "data", - "type": "newrelic_entity", - "name": "app", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "application_id": 515583865, - "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", - "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", - "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTE1NTgzODY1", - "ignore_case": false, - "ignore_not_found": false, - "name": "rails_api_base - development", - "serving_apm_application_id": null, - "tag": null, - "type": "APPLICATION" - }, - "sensitive_attributes": [], - "identity_schema_version": 0 - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "application_id": 524986998, - "domain": "APM", - "entity_tags": "[{\"key\":\"account\",\"values\":[\"Account 6572468\"]},{\"key\":\"accountId\",\"values\":[\"6572468\"]},{\"key\":\"agentVersion\",\"values\":[\"9.18.0\"]},{\"key\":\"instrumentation.name\",\"values\":[\"apm\"]},{\"key\":\"instrumentation.provider\",\"values\":[\"newRelic\"]},{\"key\":\"language\",\"values\":[\"ruby\"]},{\"key\":\"nr.logAccountId\",\"values\":[\"6572468\"]},{\"key\":\"nr.logEventType\",\"values\":[\"Log\"]},{\"key\":\"nr.tracing\",\"values\":[\"standard\"]},{\"key\":\"trustedAccountId\",\"values\":[\"6572468\"]}]", - "guid": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", - "id": "NjU3MjQ2OHxBUE18QVBQTElDQVRJT058NTI0OTg2OTk4", - "ignore_case": false, - "ignore_not_found": false, - "name": "rails_api_base - development2", - "serving_apm_application_id": null, - "tag": null, - "type": "APPLICATION" - }, - "sensitive_attributes": [], - "identity_schema_version": 0 - } - ] - }, - { - "mode": "managed", - "type": "newrelic_alert_policy", - "name": "golden_metrics_policy", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6333783", - "incident_preference": "PER_POLICY", - "name": "Golden Signals - rails_api_base - development" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "bnVsbA==" - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6333785", - "incident_preference": "PER_POLICY", - "name": "Golden Signals - rails_api_base - development2" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "bnVsbA==" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_alert_policy", - "name": "percentiles_policy", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6333782", - "incident_preference": "PER_POLICY", - "name": "Percentiles - rails_api_base - development" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "bnVsbA==" - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "channel_ids": null, - "id": "6333784", - "incident_preference": "PER_POLICY", - "name": "Percentiles - rails_api_base - development2" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "bnVsbA==" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_notification_channel", - "name": "email_channel", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "active": true, - "destination_id": "d3934e69-fe90-4958-840d-052bfb0864d3", - "id": "382405ca-0940-4337-ac0c-436ae392e5eb", - "name": "Email channel - rails_api_base - development", - "product": "IINT", - "property": [ - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - }, - { - "display_value": "", - "key": "subject", - "label": "", - "value": "New Alert" - } - ], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_notification_destination.email_destination" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "active": true, - "destination_id": "703ab473-75bf-41a6-8264-be5d0b15cce5", - "id": "c0b3137b-8afd-4aed-821b-92ca7cfa203e", - "name": "Email channel - rails_api_base - development2", - "product": "IINT", - "property": [ - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - }, - { - "display_value": "", - "key": "subject", - "label": "", - "value": "New Alert" - } - ], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_notification_destination.email_destination" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_notification_destination", - "name": "email_destination", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "active": true, - "auth_basic": [], - "auth_custom_header": [], - "auth_token": [], - "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnxkMzkzNGU2OS1mZTkwLTQ5NTgtODQwZC0wNTJiZmIwODY0ZDM", - "id": "d3934e69-fe90-4958-840d-052bfb0864d3", - "last_sent": "", - "name": "Email destination - rails_api_base - development", - "property": [ - { - "display_value": "", - "key": "email", - "label": "", - "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" - }, - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - } - ], - "secure_url": [], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "active": true, - "auth_basic": [], - "auth_custom_header": [], - "auth_token": [], - "guid": "NjU3MjQ2OHxBSU9QU3xERVNUSU5BVElPTnw3MDNhYjQ3My03NWJmLTQxYTYtODI2NC1iZTVkMGIxNWNjZTU", - "id": "703ab473-75bf-41a6-8264-be5d0b15cce5", - "last_sent": "", - "name": "Email destination - rails_api_base - development2", - "property": [ - { - "display_value": "", - "key": "email", - "label": "", - "value": "julian.pasquale@rootstrap.com,ignacio.perez@rootstrap.com" - }, - { - "display_value": "", - "key": "source", - "label": "terraform-source-internal", - "value": "terraform" - } - ], - "secure_url": [], - "status": "DEFAULT", - "timeouts": null, - "type": "EMAIL" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxNjAwMDAwMDAwMCwidXBkYXRlIjoxNjAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "error_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above_or_equals", - "prediction": [], - "threshold": 1, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "Error Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1Nzg4Mzk", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333783:52578839", - "ignore_on_expected_termination": false, - "name": "Error alert - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT count(*) FROM Transaction WHERE error IS true AND appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333783, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above_or_equals", - "prediction": [], - "threshold": 1, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "Error Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1Nzg4NDA", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333785:52578840", - "ignore_on_expected_termination": false, - "name": "Error alert - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT count(*) FROM Transaction WHERE error IS true AND appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333785, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "low_throughput", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "below", - "prediction": [], - "threshold": 5, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "Low Throughput", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzM", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333783:52578173", - "ignore_on_expected_termination": false, - "name": "Low Throughput - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "FROM Transaction SELECT count(*) WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333783, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "below", - "prediction": [], - "threshold": 5, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "Low Throughput", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDk", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333785:52578209", - "ignore_on_expected_termination": false, - "name": "Low Throughput - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "FROM Transaction SELECT count(*) WHERE appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333785, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "p90_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1.5, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P90 Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzI", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333782:52578172", - "ignore_on_expected_termination": false, - "name": "P90 Alert - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333782, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.percentiles_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1.5, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P90 Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDc", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333784:52578207", - "ignore_on_expected_termination": false, - "name": "P90 Alert - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333784, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.percentiles_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "p90_latency_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "High Transaction Response Time", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMjE", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333783:52879221", - "ignore_on_expected_termination": false, - "name": "P90 Response Time - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333783, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 1, - "threshold_duration": 300, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "High Transaction Response Time", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkyMTk", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333785:52879219", - "ignore_on_expected_termination": false, - "name": "P90 Response Time - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333785, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "p95_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 5, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P95 Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgxNzE", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333782:52578171", - "ignore_on_expected_termination": false, - "name": "P95 Alert - rails_api_base - development", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 95) FROM Transaction WHERE appName = 'rails_api_base - development'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333782, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.percentiles_policy" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 5, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P95 Alert", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI1NzgyMDY", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333784:52578206", - "ignore_on_expected_termination": false, - "name": "P95 Alert - rails_api_base - development2", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 95) FROM Transaction WHERE appName = 'rails_api_base - development2'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333784, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.percentiles_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_nrql_alert_condition", - "name": "transaction_p90_alert", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development2|Controller/admin/admin_users/index", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 0.2, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P90 Alert for Controller/admin/admin_users/index in rails_api_base - development2", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkzMjg", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333784:52879328", - "ignore_on_expected_termination": false, - "name": "P90 Alert - rails_api_base - development2 - Admin Users Index", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development2' AND name = 'Controller/admin/admin_users/index'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333784, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.percentiles_policy" - ] - }, - { - "index_key": "rails_api_base - development|Controller/admin/admin_users/index", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "aggregation_delay": "120", - "aggregation_method": "event_flow", - "aggregation_timer": null, - "aggregation_window": 60, - "baseline_direction": null, - "close_violations_on_expiration": false, - "critical": [ - { - "duration": 0, - "operator": "above", - "prediction": [], - "threshold": 0.2, - "threshold_duration": 60, - "threshold_occurrences": "all", - "time_function": "" - } - ], - "description": "P90 Alert for Controller/admin/admin_users/index in rails_api_base - development", - "enabled": true, - "entity_guid": "NjU3MjQ2OHxBSU9QU3xDT05ESVRJT058NTI4NzkzMjc", - "evaluation_delay": null, - "expiration_duration": 0, - "fill_option": "none", - "fill_value": 0, - "id": "6333782:52879327", - "ignore_on_expected_termination": false, - "name": "P90 Alert - rails_api_base - development - Admin Users Index", - "nrql": [ - { - "data_account_id": 6572468, - "evaluation_offset": 0, - "query": "SELECT percentile(duration, 90) FROM Transaction WHERE appName = 'rails_api_base - development' AND name = 'Controller/admin/admin_users/index'", - "since_value": "" - } - ], - "open_violation_on_expiration": false, - "policy_id": 6333782, - "runbook_url": "", - "signal_seasonality": null, - "slide_by": null, - "term": [], - "timeouts": null, - "title_template": "", - "type": "static", - "violation_time_limit": "NON_MATCHABLE_LIMIT_VALUE", - "violation_time_limit_seconds": 259200, - "warning": [] - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMH19", - "dependencies": [ - "newrelic_alert_policy.percentiles_policy" - ] - } - ] - }, - { - "mode": "managed", - "type": "newrelic_one_dashboard_json", - "name": "activerecord_dashboard", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", - "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", - "json": "{\n \"name\": \"Activerecord - rails_api_base - development\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Non-Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", - "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzI5", - "timeouts": null, - "updated_at": "2025-06-13T17:36:34.946813Z" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMH19" - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 0, - "attributes": { - "account_id": 6572468, - "guid": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", - "id": "NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", - "json": "{\n \"name\": \"Activerecord - rails_api_base - development2\",\n \"description\": \"Basic dashboard for Activerecord\",\n \"permissions\": \"PUBLIC_READ_WRITE\",\n \"pages\": [\n {\n \"name\": \"Overview\",\n \"description\": \"Overview\",\n \"widgets\": [\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 1,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Transactions](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Transactions.png)\\n\"\n }\n },\n {\n \"title\": \"Transactions Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 1,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": \"\",\n \"layout\": {\n \"column\": 1,\n \"row\": 4,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![Errors](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/Errors.png)\\n\"\n }\n },\n {\n \"title\": \"Errors Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 4,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Transaction SELECT count(*) as 'Total transactions',percentage(count(*), WHERE error IS true) as 'Failed transactions In %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n }\n ],\n \"thresholds\": []\n }\n },\n {\n \"title\": null,\n \"layout\": {\n \"column\": 1,\n \"row\": 7,\n \"width\": 5,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.markdown\"\n },\n \"rawConfiguration\": {\n \"text\": \"\\n![VM Metrics](https://raw.githubusercontent.com/newrelic/newrelic-quickstarts/main/quickstarts/ruby/curb/images/VM-metrics.png)\\n\"\n }\n },\n {\n \"title\": \"VM Overview\",\n \"layout\": {\n \"column\": 6,\n \"row\": 7,\n \"width\": 7,\n \"height\": 3\n },\n \"linkedEntityGuids\": null,\n \"visualization\": {\n \"id\": \"viz.billboard\"\n },\n \"rawConfiguration\": {\n \"dataFormatters\": [],\n \"nrqlQueries\": [\n {\n \"accountId\": \"6572468\",\n \"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n }\n ],\n \"thresholds\": []\n }\n }\n ]\n },\n {\n\t\t\t\"name\": \"Errors\",\n\t\t\t\"description\": \"Errors\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 8\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Error Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*) as 'Total transactions', percentage(count(*), WHERE error IS true) as 'Failed transactions in %', count(*) * percentage(count(*), WHERE error IS true) / 100 as 'Failed transactions' SINCE 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType = 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Errors Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction where response.status = '404' and transactionType = 'Web' TIMESERIES 10 minutes since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Latest Error\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM TransactionError SELECT latest(timestamp) as 'Latest error' SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 10 Failed Non-Web Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"Select percentage(count(*), WHERE error IS true) from Transaction WHERE transactionType != 'Web' facet name SINCE last week WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"VM Metrics\",\n\t\t\t\"description\": \"VM Metrics\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"VM Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Metric SELECT average(apm.service.cpu.usertime.utilization) * 100 as 'Average CPU utilization ', average(apm.service.memory.physical) as 'Average physical memory' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"CPU Utilization\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE appName = 'rails_api_base - development2' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.area\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 12\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Physical Memory\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(apm.service.memory.physical) FROM Metric WHERE appName = 'rails_api_base - development2' SINCE 30 minutes ago TIMESERIES\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t},\n {\n\t\t\t\"name\": \"Transactions\",\n\t\t\t\"description\": \"Transactions\",\n\t\t\t\"widgets\": [\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.billboard\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 7\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transactions Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"FROM Transaction SELECT count(*), average(duration) as 'Average duration (s)', percentile(duration, 90) as 'Slowest 10%/duration' WHERE appName = 'rails_api_base - development2' SINCE 1 WEEK AGO\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"thresholds\": []\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.pie\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 8,\n\t\t\t\t\t\t\"row\": 1,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 5\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Most Popular Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) FROM Transaction WHERE (transactionType = 'Web') SINCE last week EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Adpex Score Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT apdex(duration,t: 0.4) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 5,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Throughput Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT count(*) from Transaction TIMESERIES 1 hour since today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.line\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 9,\n\t\t\t\t\t\t\"row\": 4,\n\t\t\t\t\t\t\"height\": 3,\n\t\t\t\t\t\t\"width\": 4\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Average Transaction Duration Today Compared With 1 Week Ago\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"legend\": {\n\t\t\t\t\t\t\t\"enabled\": true\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration) FROM Transaction TIMESERIES SINCE today COMPARE WITH 1 week ago WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"yAxisLeft\": {\n\t\t\t\t\t\t\t\"zero\": true\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 1,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Top 5 Slowest Transactions\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT max(duration) FROM Transaction WHERE (transactionType = 'Web') SINCE 1 week ago LIMIT 5 EXTRAPOLATE FACET name WHERE appName = 'rails_api_base - development2'\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"other\": {\n\t\t\t\t\t\t\t\"visible\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"yAxis\": {\n\t\t\t\t\t\t\t\"label\": \"Seconds\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"visualization\": {\n\t\t\t\t\t\t\"id\": \"viz.table\"\n\t\t\t\t\t},\n\t\t\t\t\t\"layout\": {\n\t\t\t\t\t\t\"column\": 7,\n\t\t\t\t\t\t\"row\": 7,\n\t\t\t\t\t\t\"height\": 4,\n\t\t\t\t\t\t\"width\": 6\n\t\t\t\t\t},\n\t\t\t\t\t\"title\": \"Transaction Duration Overview\",\n\t\t\t\t\t\"rawConfiguration\": {\n\t\t\t\t\t\t\"dataFormatters\": [],\n\t\t\t\t\t\t\"facet\": {\n\t\t\t\t\t\t\t\"showOtherSeries\": false\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"nrqlQueries\": [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"accountId\": \"6572468\",\n\t\t\t\t\t\t\t\t\"query\": \"SELECT average(duration), max(duration), min(duration) FROM Transaction WHERE appName = 'rails_api_base - development2' FACET name\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t\"linkedEntityGuids\": null\n\t\t\t\t}\n\t\t\t]\n\t\t}\n ],\n \"variables\": []\n}\n", - "permalink": "https://one.newrelic.com/redirect/entity/NjU3MjQ2OHxWSVp8REFTSEJPQVJEfGRhOjEwMjA4MzM2", - "timeouts": null, - "updated_at": "2025-06-13T17:36:35.057018Z" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMH19" - } - ] - }, - { - "mode": "managed", - "type": "newrelic_workflow", - "name": "workflow", - "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]", - "instances": [ - { - "index_key": "rails_api_base - development", - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "destination": [ - { - "channel_id": "382405ca-0940-4337-ac0c-436ae392e5eb", - "name": "Email channel - rails_api_base - development", - "notification_triggers": [ - "ACKNOWLEDGED", - "ACTIVATED", - "CLOSED" - ], - "type": "EMAIL", - "update_original_message": true - } - ], - "destinations_enabled": true, - "enabled": true, - "enrichments": [], - "enrichments_enabled": true, - "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3xiMzIyOTIxNi0yZTcxLTRmNDktYjMxNi1mN2E3Y2E3OWEwN2Y", - "id": "b3229216-2e71-4f49-b316-f7a7ca79a07f", - "issues_filter": [ - { - "filter_id": "0ec8020f-7913-4786-a988-8adebf9f9d63", - "name": "Filter - rails_api_base - development", - "predicate": [ - { - "attribute": "accumulations.policyName", - "operator": "EXACTLY_MATCHES", - "values": [ - "Golden Signals - rails_api_base - development", - "Percentiles - rails_api_base - development" - ] - } - ], - "type": "FILTER" - } - ], - "last_run": "", - "muting_rules_handling": "NOTIFY_ALL_ISSUES", - "name": "Workflow - rails_api_base - development", - "workflow_id": "b3229216-2e71-4f49-b316-f7a7ca79a07f" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy", - "newrelic_alert_policy.percentiles_policy", - "newrelic_notification_channel.email_channel", - "newrelic_notification_destination.email_destination" - ] - }, - { - "index_key": "rails_api_base - development2", - "schema_version": 1, - "attributes": { - "account_id": 6572468, - "destination": [ - { - "channel_id": "c0b3137b-8afd-4aed-821b-92ca7cfa203e", - "name": "Email channel - rails_api_base - development2", - "notification_triggers": [ - "ACKNOWLEDGED", - "ACTIVATED", - "CLOSED" - ], - "type": "EMAIL", - "update_original_message": true - } - ], - "destinations_enabled": true, - "enabled": true, - "enrichments": [], - "enrichments_enabled": true, - "guid": "NjU3MjQ2OHxBSU9QU3xXT1JLRkxPV3xlNjdkNGVhMy1mMTFjLTQwODgtYjJmNi05OWQ2YjNmOTU1NTE", - "id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551", - "issues_filter": [ - { - "filter_id": "1b977d4e-e243-4a82-8d17-da8b039907e9", - "name": "Filter - rails_api_base - development2", - "predicate": [ - { - "attribute": "accumulations.policyName", - "operator": "EXACTLY_MATCHES", - "values": [ - "Golden Signals - rails_api_base - development2", - "Percentiles - rails_api_base - development2" - ] - } - ], - "type": "FILTER" - } - ], - "last_run": "2025-06-27T19:39:40.620Z", - "muting_rules_handling": "NOTIFY_ALL_ISSUES", - "name": "Workflow - rails_api_base - development2", - "workflow_id": "e67d4ea3-f11c-4088-b2f6-99d6b3f95551" - }, - "sensitive_attributes": [], - "identity_schema_version": 0, - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", - "dependencies": [ - "newrelic_alert_policy.golden_metrics_policy", - "newrelic_alert_policy.percentiles_policy", - "newrelic_notification_channel.email_channel", - "newrelic_notification_destination.email_destination" - ] - } - ] - } - ], - "check_results": null -} From 904f16baed13f7ff0fad49fc8c9284c74f04b840 Mon Sep 17 00:00:00 2001 From: Julian Pasquale Date: Wed, 2 Jul 2025 15:52:43 -0300 Subject: [PATCH 15/16] Update gitignore --- infra/new_relic/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/infra/new_relic/.gitignore b/infra/new_relic/.gitignore index c6550aa8..b10e9b99 100644 --- a/infra/new_relic/.gitignore +++ b/infra/new_relic/.gitignore @@ -1,2 +1,3 @@ .terraform .env +terraform.tfstate* From 9c5e7ed3b5a9fb9bedcbfd27f179612cc3fa458c Mon Sep 17 00:00:00 2001 From: Ignacio Perez Date: Fri, 4 Jul 2025 16:09:32 -0300 Subject: [PATCH 16/16] Add slack integration --- infra/new_relic/.env.sample | 2 + infra/new_relic/README.md | 13 ++- infra/new_relic/main.tf | 174 ++++++++++++++++++++++-------------- 3 files changed, 119 insertions(+), 70 deletions(-) diff --git a/infra/new_relic/.env.sample b/infra/new_relic/.env.sample index c166ca36..a7ed966b 100644 --- a/infra/new_relic/.env.sample +++ b/infra/new_relic/.env.sample @@ -1,3 +1,5 @@ NEW_RELIC_ACCOUNT_ID=1234 NEW_RELIC_API_KEY=NRAK-** NEW_RELIC_REGION=US + +TF_VAR_account_id=1234 diff --git a/infra/new_relic/README.md b/infra/new_relic/README.md index 5137775c..87587eb9 100644 --- a/infra/new_relic/README.md +++ b/infra/new_relic/README.md @@ -1,7 +1,18 @@ +# Preconditions + +## Entities +Create one New Relic entity for each environment. Current setup assumes one entity for "development", "staging" and "production" environments. For example, if your app name is "rails_api_base", it expects to have "rails_api_base - development" entity for dev. + +## Slack +Set up the Slack integration from [New Relic](https://docs.newrelic.com/docs/alerts/get-notified/notification-integrations/). You will need to replace `slack_destination_id` local variable with the id generated by the integration, and `slack_channel_id` with the channel id where you want to send notifications. + # Installation Follow the [Terraform installation docs](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) to install Terraform CLI. +## Environment variables +Make sure you copy the `.env.sample` file into `.env` and fill all the variables. + ## Usage There are only three commands that need to be run in order to apply this terraform template and fully setup your New Relic monitoring. @@ -30,4 +41,4 @@ docker run -w /app -v .:/app --env-file .env -it hashicorp/terraform:latest plan # Apply docker run -w /app -v .:/app --env-file .env -it hashicorp/terraform:latest apply -``` \ No newline at end of file +``` diff --git a/infra/new_relic/main.tf b/infra/new_relic/main.tf index 42fc5b84..fbb9c60c 100644 --- a/infra/new_relic/main.tf +++ b/infra/new_relic/main.tf @@ -12,21 +12,23 @@ terraform { locals { transactions_per_environment = { "Admin Users Index" = { - transaction_name = "Controller/admin/admin_users/index" + transaction_name = "Controller/admin/admin_users/index" p90_latency_threshold = 0.2 } } # Must be an exact match to your application name in New Relic - app_name = "rails_api_base" - app_environments = ["development", "staging", "production"] - devs_emails = ["devs@example.com"] + app_name = "rails_api_base" + app_environments = ["development", "staging", "production"] + slack_channel_id = "your-slack-channel-id" + slack_destination_id = "your-slack-destination-id" + devs_emails = ["devs@example.com"] app_names = [ for env in local.app_environments : "${local.app_name} - ${env}" ] transactions = flatten([ for app in local.app_names : [ for t_k, t_v in local.transactions_per_environment : merge({ - app_name = app, + app_name = app, friendly_name = t_k }, t_v) ] @@ -37,30 +39,30 @@ locals { provider "newrelic" {} variable "account_id" { - type = number + type = number description = "New Relic account ID." } data "newrelic_entity" "app" { for_each = toset(local.app_names) - name = each.value - domain = "APM" - type = "APPLICATION" + name = each.value + domain = "APM" + type = "APPLICATION" } resource "newrelic_alert_policy" "rails_app_policy" { for_each = toset(local.app_names) - name = "Rails app policy - ${each.value}" + name = "Rails app policy - ${each.value}" } # Throughput condition resource "newrelic_nrql_alert_condition" "low_throughput" { - for_each = toset(local.app_names) - policy_id = newrelic_alert_policy.rails_app_policy[each.value].id - type = "static" - name = "Low Throughput - ${each.value}" - description = "Low Throughput" - enabled = true + for_each = toset(local.app_names) + policy_id = newrelic_alert_policy.rails_app_policy[each.value].id + type = "static" + name = "Low Throughput - ${each.value}" + description = "Low Throughput" + enabled = true violation_time_limit_seconds = 259200 # 3 days nrql { @@ -68,21 +70,21 @@ resource "newrelic_nrql_alert_condition" "low_throughput" { } critical { - threshold = 5 - threshold_duration = 300 + threshold = 5 + threshold_duration = 300 threshold_occurrences = "ALL" - operator = "below" + operator = "below" } } # Error rate condition resource "newrelic_nrql_alert_condition" "error_alert" { - for_each = toset(local.app_names) - policy_id = newrelic_alert_policy.rails_app_policy[each.value].id - type = "static" - name = "Error alert - ${each.value}" - description = "Error Alert" - enabled = true + for_each = toset(local.app_names) + policy_id = newrelic_alert_policy.rails_app_policy[each.value].id + type = "static" + name = "Error alert - ${each.value}" + description = "Error Alert" + enabled = true violation_time_limit_seconds = 259200 # 3 days nrql { @@ -90,10 +92,10 @@ resource "newrelic_nrql_alert_condition" "error_alert" { } critical { - threshold = 1 - threshold_duration = 60 + threshold = 1 + threshold_duration = 60 threshold_occurrences = "ALL" - operator = "above_or_equals" + operator = "above_or_equals" } } @@ -103,12 +105,12 @@ resource "newrelic_nrql_alert_condition" "error_alert" { # Global P90 Alert resource "newrelic_nrql_alert_condition" "p90_latency_alert" { - for_each = toset(local.app_names) - policy_id = newrelic_alert_policy.rails_app_policy[each.value].id - type = "static" - name = "P90 Response Time - ${each.value}" - description = "High P90 Response Time" - enabled = true + for_each = toset(local.app_names) + policy_id = newrelic_alert_policy.rails_app_policy[each.value].id + type = "static" + name = "P90 Response Time - ${each.value}" + description = "High P90 Response Time" + enabled = true violation_time_limit_seconds = 259200 # 3 days nrql { @@ -116,21 +118,21 @@ resource "newrelic_nrql_alert_condition" "p90_latency_alert" { } critical { - operator = "above" - threshold = 1 - threshold_duration = 300 + operator = "above" + threshold = 1 + threshold_duration = 300 threshold_occurrences = "ALL" } } # Global P95 Alert resource "newrelic_nrql_alert_condition" "p95_alert" { - for_each = toset(local.app_names) - policy_id = newrelic_alert_policy.rails_app_policy[each.value].id - type = "static" - name = "P95 Response Time - ${each.value}" - description = "High P95 Response Time" - enabled = true + for_each = toset(local.app_names) + policy_id = newrelic_alert_policy.rails_app_policy[each.value].id + type = "static" + name = "P95 Response Time - ${each.value}" + description = "High P95 Response Time" + enabled = true violation_time_limit_seconds = 259200 # 3 days nrql { @@ -138,21 +140,21 @@ resource "newrelic_nrql_alert_condition" "p95_alert" { } critical { - threshold = 1 - threshold_duration = 300 + threshold = 1 + threshold_duration = 300 threshold_occurrences = "ALL" - operator = "above" + operator = "above" } } # Generate a P90 alert for each transaction defined in locals.transactions resource "newrelic_nrql_alert_condition" "transaction_p90_alert" { - for_each = { for t in local.transactions : "${t.app_name}|${t.transaction_name}" => t } - policy_id = newrelic_alert_policy.rails_app_policy[each.value.app_name].id - type = "static" - name = "P90 Alert on ${each.value.friendly_name} - ${each.value.app_name}" - description = "P90 Alert on ${each.value.transaction_name} in ${each.value.app_name}" - enabled = true + for_each = { for t in local.transactions : "${t.app_name}|${t.transaction_name}" => t } + policy_id = newrelic_alert_policy.rails_app_policy[each.value.app_name].id + type = "static" + name = "P90 Alert on ${each.value.friendly_name} - ${each.value.app_name}" + description = "P90 Alert on ${each.value.transaction_name} in ${each.value.app_name}" + enabled = true violation_time_limit_seconds = 259200 # 3 days nrql { @@ -160,10 +162,10 @@ resource "newrelic_nrql_alert_condition" "transaction_p90_alert" { } critical { - threshold = each.value.p90_latency_threshold - threshold_duration = 300 + threshold = each.value.p90_latency_threshold + threshold_duration = 300 threshold_occurrences = "ALL" - operator = "above" + operator = "above" } } @@ -174,7 +176,7 @@ resource "newrelic_nrql_alert_condition" "transaction_p90_alert" { resource "newrelic_one_dashboard_json" "activerecord_dashboard" { for_each = toset(local.app_names) json = templatefile("${path.module}/dashboard.json.tftpl", { - app_name = each.value, + app_name = each.value, account_id = var.account_id }) } @@ -185,32 +187,32 @@ resource "newrelic_one_dashboard_json" "activerecord_dashboard" { resource "newrelic_notification_destination" "email_destination" { for_each = toset(local.app_names) - name = "Email destination - ${each.value}" - type = "EMAIL" + name = "Email destination - ${each.value}" + type = "EMAIL" property { - key = "email" + key = "email" value = join(",", local.devs_emails) } } resource "newrelic_notification_channel" "email_channel" { - for_each = toset(local.app_names) - name = "Email channel - ${each.value}" - type = "EMAIL" + for_each = toset(local.app_names) + name = "Email channel - ${each.value}" + type = "EMAIL" destination_id = newrelic_notification_destination.email_destination[each.value].id - product = "IINT" + product = "IINT" property { - key = "subject" + key = "subject" value = "New Alert" } } resource "newrelic_workflow" "workflow" { - for_each = toset(local.app_names) - name = "Workflow - ${each.value}" - enabled = true + for_each = toset(local.app_names) + name = "Workflow - ${each.value}" + enabled = true muting_rules_handling = "NOTIFY_ALL_ISSUES" issues_filter { @@ -219,9 +221,9 @@ resource "newrelic_workflow" "workflow" { predicate { attribute = "accumulations.policyName" - operator = "EXACTLY_MATCHES" + operator = "EXACTLY_MATCHES" values = [ - newrelic_alert_policy.rails_app_policy[each.value].name + for app in local.app_names : newrelic_alert_policy.rails_app_policy[app].name ] } } @@ -230,3 +232,37 @@ resource "newrelic_workflow" "workflow" { channel_id = newrelic_notification_channel.email_channel[each.value].id } } +resource "newrelic_notification_channel" "slack_channel" { + name = "Slack channel" + type = "SLACK" + destination_id = local.slack_destination_id + product = "IINT" + + property { + key = "channelId" + value = local.slack_channel_id + } +} + +resource "newrelic_workflow" "slack_workflow" { + name = "Slack workflow" + enabled = true + muting_rules_handling = "NOTIFY_ALL_ISSUES" + + issues_filter { + name = "Filter" + type = "FILTER" + + predicate { + attribute = "accumulations.policyName" + operator = "EXACTLY_MATCHES" + values = [ + for app in local.app_names : newrelic_alert_policy.rails_app_policy[app].name + ] + } + } + + destination { + channel_id = newrelic_notification_channel.slack_channel.id + } +}