Skip to content

Commit 43d8830

Browse files
author
ADOT Patch workflow
committed
Revert "Implement Unit Test for AWS Metric Attributes Span Exporter (#30)"
This reverts commit 928a5be.
1 parent 552ba02 commit 43d8830

File tree

2 files changed

+14
-395
lines changed

2 files changed

+14
-395
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
3-
import copy
43
from typing import List, Sequence, TypeVar
54

65
from typing_extensions import override
@@ -103,11 +102,12 @@ def copy_attributes_with_local_root(attributes: BoundedAttributes) -> BoundedAtt
103102
)
104103

105104

105+
# TODO: AwsMetricAttributesSpanExporter depends on internal ReadableSpan method _attributes.
106+
# This is a bit risky but is required for our implementation.
107+
# The risk is that the implementation of _attributes changes in the future.
108+
# We need tests that thoroughly test this behaviour to make sure it does not change upstream.
106109
def wrap_span_with_attributes(span: ReadableSpan, attributes: BoundedAttributes) -> ReadableSpan:
107-
# To make sure we create a new span without influence original span's Attributes
108-
# We have to create a deepcopy for it
109-
new_span = copy.deepcopy(span)
110-
original_attributes: AttributesT = new_span.attributes
110+
original_attributes: AttributesT = span.attributes
111111
update_attributes: types.Attributes = {}
112112
# Copy all attribute in span into update_attributes
113113
for key, value in original_attributes.items():
@@ -117,12 +117,12 @@ def wrap_span_with_attributes(span: ReadableSpan, attributes: BoundedAttributes)
117117
update_attributes[key] = value
118118

119119
if isinstance(original_attributes, BoundedAttributes):
120-
new_span._attributes = BoundedAttributes(
120+
span._attributes = BoundedAttributes(
121121
maxlen=original_attributes.maxlen,
122122
attributes=update_attributes,
123123
immutable=original_attributes._immutable,
124124
max_value_len=original_attributes.max_value_len,
125125
)
126126
else:
127-
new_span._attributes = update_attributes
128-
return new_span
127+
span._attributes = update_attributes
128+
return span

0 commit comments

Comments
 (0)