From 208d65353da2aecdda6b98b8af63f39b22ba68c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Nordstrand?= Date: Thu, 29 Aug 2024 11:27:50 +0200 Subject: [PATCH] Use existing environment variables for cloudwatch We already have DD_SERVICE and DD_ENV that we use for datadog, these might as well also be used for the request queue time metric. --- README.md | 10 ++++++++-- lib/services/auto_scaling_metrics/reporter.rb | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 02be159..4567514 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,14 @@ And then execute: The following environment variables are required for the metric that is reported to cloudwatch: ```rb - ENV["APP_NAME"] - ENV["SERVER_ENVIRONMENT"] + ENV["DD_SERVICE"] + ENV["DD_ENV"] +``` + +For example: +```rb + ENV["DD_SERVICE"] = "teamtailor" + ENV["DD_ENV"] = "eu-cyan" ``` For the Reporter to run, you need to have the following flag set as well: diff --git a/lib/services/auto_scaling_metrics/reporter.rb b/lib/services/auto_scaling_metrics/reporter.rb index c310e3e..5b9d4e4 100644 --- a/lib/services/auto_scaling_metrics/reporter.rb +++ b/lib/services/auto_scaling_metrics/reporter.rb @@ -12,8 +12,8 @@ class Reporter include Singleton DIMENSIONS = [ - {name: "service", value: ENV["APP_NAME"]}, - {name: "environment", value: ENV["SERVER_ENVIRONMENT"]} + {name: "service", value: ENV["DD_SERVICE"]}, + {name: "environment", value: ENV["DD_ENV"]} ] attr_accessor :collector