Skip to content

Commit f2af53f

Browse files
committed
fmt
1 parent 9b0476b commit f2af53f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/datadog/core/configuration/settings.rb

+8-6
Original file line numberDiff line numberDiff line change
@@ -629,15 +629,17 @@ def initialize(*_)
629629
env_value.split(sep).each do |tag|
630630
tag.strip!
631631
next if tag.empty?
632+
632633
# tag by : or = (for OpenTelemetry)
633634
key, val = if tag.include?(':')
634-
tag.split(':', 2).map(&:strip)
635-
elsif tag.include?('=')
636-
tag.split('=', 2).map(&:strip)
637-
else
638-
[tag.strip, '']
639-
end
635+
tag.split(':', 2).map(&:strip)
636+
elsif tag.include?('=')
637+
tag.split('=', 2).map(&:strip)
638+
else
639+
[tag.strip, '']
640+
end
640641
next if key.empty?
642+
641643
# maps OpenTelemetry semantic attributes to Datadog tags
642644
case key.downcase
643645
when 'deployment.environment'

spec/datadog/core/configuration/settings_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,11 @@
11081108
['key', 'key:', 'key: '].each do |tag|
11091109
context "when tag is #{tag.inspect}" do
11101110
let(:env_tags) { tag }
1111-
it { is_expected.to eq({"key" => ""}) }
1111+
it { is_expected.to eq({ 'key' => '' }) }
11121112
end
11131113
end
11141114
end
1115+
11151116
context 'with multiple colons' do
11161117
let(:env_tags) { 'key:va:lue' }
11171118

0 commit comments

Comments
 (0)