Skip to content

Commit 3c822a8

Browse files
authored
Fix a behaviour for wrap_span_with_attributes (#29)
*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.
1 parent dc1c3ca commit 3c822a8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_metric_attributes_span_exporter.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,9 @@ def wrap_span_with_attributes(span: ReadableSpan, attributes: BoundedAttributes)
112112
# Copy all attribute in span into update_attributes
113113
for key, value in original_attributes.items():
114114
update_attributes[key] = value
115-
# Append all attribute in attributes that is not in original_attributes into update_attributes
115+
# Replace existing span-attributes if there is same key in Attributes
116116
for key, value in attributes.items():
117-
if key not in update_attributes:
118-
update_attributes[key] = value
117+
update_attributes[key] = value
119118

120119
if isinstance(original_attributes, BoundedAttributes):
121120
span._attributes = BoundedAttributes(

0 commit comments

Comments
 (0)