Skip to content

Commit 1cd5298

Browse files
committed
Fix handling of not attribute values inside sequences
1 parent 70e838d commit 1cd5298

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

opentelemetry-api/src/opentelemetry/attributes/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,10 @@ def _clean_extended_attribute_value(
157157

158158
element_type = type(element)
159159
if element_type not in _VALID_ATTR_VALUE_TYPES:
160-
return _clean_extended_attribute_value(
160+
element = _clean_extended_attribute_value(
161161
element, max_len=max_len
162162
)
163+
element_type = type(element)
163164

164165
# The type of the sequence must be homogeneous. The first non-None
165166
# element determines the type of the sequence

opentelemetry-api/tests/attributes/test_attributes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def test_clean_extended_attribute(self):
139139
# mappings
140140
self.assertValid({})
141141
self.assertValid({"k": "v"})
142+
# mappings in sequences
143+
self.assertValid([{"k": "v"}])
142144

143145
# test keys
144146
self.assertValid("value", "key")

0 commit comments

Comments
 (0)