Skip to content

Commit

Permalink
Fix a behaviour for wrap_span_with_attributes (#29)
Browse files Browse the repository at this point in the history
*Issue #, if available:*
Fix a behaviour for wrap span with attributes, to match behaviour in
Java
*Description of changes:*
Now attributes inputed will replace existing attributes in span
attributes with same key in wrap_span_with_attributes

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
  • Loading branch information
XinRanZhAWS authored Jan 24, 2024
1 parent dc1c3ca commit 3c822a8
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ def wrap_span_with_attributes(span: ReadableSpan, attributes: BoundedAttributes)
# Copy all attribute in span into update_attributes
for key, value in original_attributes.items():
update_attributes[key] = value
# Append all attribute in attributes that is not in original_attributes into update_attributes
# Replace existing span-attributes if there is same key in Attributes
for key, value in attributes.items():
if key not in update_attributes:
update_attributes[key] = value
update_attributes[key] = value

if isinstance(original_attributes, BoundedAttributes):
span._attributes = BoundedAttributes(
Expand Down

0 comments on commit 3c822a8

Please sign in to comment.