File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
lib/datadog/core/configuration
spec/datadog/core/configuration Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -578,7 +578,16 @@ def initialize(*_)
578578 # @return [String]
579579 option :service do |o |
580580 # DEV-2.0: Remove this conversion for symbol.
581- o . setter { |v | v . to_s if v }
581+ o . setter do |v |
582+ unless v . nil? || v . is_a? ( String )
583+ Datadog ::Core . log_deprecation do
584+ "Use of non-strings for 'service' configuration is deprecated. " \
585+ 'Use a string instead.'
586+ end
587+ end
588+
589+ v . to_s if v
590+ end
582591
583592 # NOTE: service also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details.
584593 o . env Core ::Environment ::Ext ::ENV_SERVICE
Original file line number Diff line number Diff line change 10411041 context 'when given a symbol' do
10421042 let ( :service ) { :symbol }
10431043
1044- before { set_service }
1045-
1046- it { expect ( settings . service ) . to eq ( 'symbol' ) }
1044+ it { expect { set_service } . to log_deprecation }
1045+ it { expect { set_service } . to change { settings . service } . to ( 'symbol' ) }
10471046 end
10481047
10491048 context 'when given `nil`' do
You can’t perform that action at this time.
0 commit comments