Skip to content

Commit 63ca2f5

Browse files
fix(tracing/internal): fix encoding of propagated internal tags (#3320) (#3322)
Fixes: #3318 (cherry picked from commit b2819af) Co-authored-by: Brett Langdon <[email protected]>
1 parent 2de4e1c commit 63ca2f5

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

ddtrace/internal/_tagset.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ cdef bint _value_is_valid(str value):
152152
return 0
153153

154154
for c in value:
155-
if not is_valid_key_char(ord(c)):
155+
if not is_valid_value_char(ord(c)):
156156
return 0
157157
return 1
158158

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
tracing/internal: fix encoding of propagated internal tags.

tests/tracer/test_tagset.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,16 @@ def test_decode_tagset_string_malformed(header):
9292
({}, ""),
9393
# Single key/value
9494
({"key": "value"}, "key=value"),
95+
# Allow equals in values
96+
({"key": "value=with=equals"}, "key=value=with=equals"),
9597
# Multiple key/values
9698
# DEV: Use OrderedDict to ensure consistent iteration for encoding
9799
(OrderedDict([("a", "1"), ("b", "2"), ("c", "3")]), "a=1,b=2,c=3"),
100+
# Realistic example
101+
(
102+
{"_dd.p.upstream_services": "Z3JwYy1jbGllbnQ=|1|0|1.0000"},
103+
"_dd.p.upstream_services=Z3JwYy1jbGllbnQ=|1|0|1.0000",
104+
),
98105
],
99106
)
100107
def test_encode_tagset_values(values, expected):
@@ -125,7 +132,6 @@ def test_encode_tagset_values_strip_spaces():
125132
{"key": "value,with,commas"},
126133
# disallow equals
127134
{"key=with=equals": "value"},
128-
{"key": "value=with=equals"},
129135
# Empty key or value
130136
{"": "value"},
131137
{"key": ""},

0 commit comments

Comments
 (0)