From 23a9645824538b9145121b3bd4bd6968e96b6924 Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Tue, 12 Dec 2023 15:16:24 -0800 Subject: [PATCH] Ensure service and env are strings --- lib/datadog/core/configuration/settings.rb | 7 ++----- spec/datadog/core/configuration/settings_spec.rb | 16 ---------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/datadog/core/configuration/settings.rb b/lib/datadog/core/configuration/settings.rb index 483c01a2a2b..bcd1c3bf906 100644 --- a/lib/datadog/core/configuration/settings.rb +++ b/lib/datadog/core/configuration/settings.rb @@ -156,9 +156,7 @@ def initialize(*_) # @default `DD_ENV` environment variable, otherwise `nil` # @return [String,nil] option :env do |o| - # DEV-2.0: Remove this conversion for symbol. - o.setter { |v| v.to_s if v } - + o.type :string, nilable: true # NOTE: env also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details. o.env Core::Environment::Ext::ENV_ENVIRONMENT end @@ -404,8 +402,7 @@ def initialize(*_) # @default `DD_SERVICE` environment variable, otherwise the program name (e.g. `'ruby'`, `'rails'`, `'pry'`) # @return [String] option :service do |o| - # DEV-2.0: Remove this conversion for symbol. - o.setter { |v| v.to_s if v } + o.type :string, nilable: true # NOTE: service also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details. o.env Core::Environment::Ext::ENV_SERVICE diff --git a/spec/datadog/core/configuration/settings_spec.rb b/spec/datadog/core/configuration/settings_spec.rb index e911bfe1a0a..5a3460def1a 100644 --- a/spec/datadog/core/configuration/settings_spec.rb +++ b/spec/datadog/core/configuration/settings_spec.rb @@ -227,14 +227,6 @@ it { expect(settings.env).to eq(env) } end - context 'when given a symbol' do - let(:env) { :symbol } - - before { set_env } - - it { expect(settings.env).to eq('symbol') } - end - context 'when given `nil`' do let(:env) { nil } @@ -839,14 +831,6 @@ it { expect(settings.service).to eq(service) } end - context 'when given a symbol' do - let(:service) { :symbol } - - before { set_service } - - it { expect(settings.service).to eq('symbol') } - end - context 'when given `nil`' do let(:service) { nil }