From b788eec64fbfb5989230aa27eb4b560f33bc901c Mon Sep 17 00:00:00 2001 From: Robin Schroer Date: Thu, 18 Jan 2024 13:58:25 +0900 Subject: [PATCH] Try to infer the service name if it's not explicitly set --- lib/degica_datadog/config.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/degica_datadog/config.rb b/lib/degica_datadog/config.rb index 182570c..bdd293f 100644 --- a/lib/degica_datadog/config.rb +++ b/lib/degica_datadog/config.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "datadog/statsd" +require "rails" require "json" require "uri" @@ -17,7 +18,7 @@ def statsd_client end def service - ENV.fetch("SERVICE_NAME", nil) + ENV.fetch("SERVICE_NAME", Rails.application&.class&.module_parent_name&.downcase) end def version