File tree 2 files changed +4
-2
lines changed
lib/opentelemetry/sdk/resources 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 4
4
#
5
5
# SPDX-License-Identifier: Apache-2.0
6
6
7
+ require 'uri'
8
+
7
9
module OpenTelemetry
8
10
module SDK
9
11
module Resources
@@ -46,7 +48,7 @@ def telemetry_sdk
46
48
47
49
resource_pairs . split ( ',' ) . each do |pair |
48
50
key , value = pair . split ( '=' )
49
- resource_attributes [ key . strip ] = value
51
+ resource_attributes [ key . strip ] = URI . decode_www_form_component ( value ) . strip
50
52
end
51
53
52
54
resource_attributes . delete_if { |_key , value | value . nil? || value . empty? }
Original file line number Diff line number Diff line change 89
89
end
90
90
91
91
it 'cleans up whitespace in user provided resources' do
92
- OpenTelemetry ::TestHelpers . with_env ( 'OTEL_RESOURCE_ATTRIBUTES' => 'important_foo=x, important_bar=y' ) do
92
+ OpenTelemetry ::TestHelpers . with_env ( 'OTEL_RESOURCE_ATTRIBUTES' => ' important_foo=x, important_bar=y ' ) do
93
93
configurator . resource = OpenTelemetry ::SDK ::Resources ::Resource . create ( )
94
94
_ ( configurator_resource_attributes ) . must_equal ( default_resource_attributes . merge ( 'important_foo' => 'x' , 'important_bar' => 'y' ) )
95
95
end
You can’t perform that action at this time.
0 commit comments