Commit 64cb8a6 1 parent bf52570 commit 64cb8a6 Copy full SHA for 64cb8a6
File tree 2 files changed +32
-8
lines changed
lib/datadog/tracing/distributed
sig/datadog/tracing/distributed
2 files changed +32
-8
lines changed Original file line number Diff line number Diff line change @@ -103,21 +103,17 @@ def parse_baggage_header(baggage_header)
103
103
baggage = { }
104
104
baggages = baggage_header . split ( ',' )
105
105
baggages . each do |key_value |
106
- next unless key_value . include? ( '=' )
107
-
108
106
key , value = key_value . split ( '=' , 2 )
109
- key = decode_and_preserve_safe_characters ( key . strip , SAFE_CHARACTERS_KEY )
110
- value = decode_and_preserve_safe_characters ( value . strip , SAFE_CHARACTERS_VALUE )
107
+ next unless key && value
108
+
109
+ key = URI . decode_www_form_component ( key . strip )
110
+ value = URI . decode_www_form_component ( value . strip )
111
111
next if key . empty? || value . empty?
112
112
113
113
baggage [ key ] = value
114
114
end
115
115
baggage
116
116
end
117
-
118
- def decode_and_preserve_safe_characters ( str , _safe_characters )
119
- URI . decode_www_form_component ( str )
120
- end
121
117
end
122
118
end
123
119
end
Original file line number Diff line number Diff line change
1
+ module Datadog
2
+ module Tracing
3
+ module Distributed
4
+ class Baggage
5
+ BAGGAGE_KEY : "baggage"
6
+ DD_TRACE_BAGGAGE_MAX_ITEMS : 64
7
+ DD_TRACE_BAGGAGE_MAX_BYTES : 8192
8
+ SAFE_CHARACTERS_KEY : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$!#&'*+-.^_`|~"
9
+ SAFE_CHARACTERS_VALUE : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$!#&'()*+-./:<>?@[]^_`{|}~"
10
+
11
+ def initialize : (fetcher: untyped , baggage_key: string) -> void
12
+
13
+ def inject! : (untyped digest, untyped data) -> (nil | untyped )
14
+
15
+ def extract : (untyped data) -> (nil | untyped )
16
+
17
+
18
+ private
19
+
20
+ def encode_key : (String key) -> string
21
+
22
+ def encode_value : (String key) -> string
23
+
24
+ def parse_baggage_header : (String baggage_header) -> hash[string, string]
25
+ end
26
+ end
27
+ end
28
+ end
You can’t perform that action at this time.
0 commit comments