diff --git a/opentelemetry-api/src/opentelemetry/trace/span.py b/opentelemetry-api/src/opentelemetry/trace/span.py index 325bb9064a..6e54dfc721 100644 --- a/opentelemetry-api/src/opentelemetry/trace/span.py +++ b/opentelemetry-api/src/opentelemetry/trace/span.py @@ -79,7 +79,7 @@ def get_span_context(self) -> "SpanContext": @abc.abstractmethod def set_attributes( - self, attributes: typing.Dict[str, types.AttributeValue] + self, attributes: typing.Mapping[str, types.AttributeValue] ) -> None: """Sets Attributes. @@ -529,7 +529,7 @@ def end(self, end_time: typing.Optional[int] = None) -> None: pass def set_attributes( - self, attributes: typing.Dict[str, types.AttributeValue] + self, attributes: typing.Mapping[str, types.AttributeValue] ) -> None: pass diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index 2e4448387c..ec5bc3f0fe 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -30,6 +30,7 @@ Dict, Iterator, List, + Mapping, MutableMapping, Optional, Sequence, @@ -842,7 +843,7 @@ def get_span_context(self): return self._context def set_attributes( - self, attributes: Dict[str, types.AttributeValue] + self, attributes: Mapping[str, types.AttributeValue] ) -> None: with self._lock: if self._end_time is not None: