Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/5183.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`opentelemetry-sdk`: tighten `ReadableSpan.attributes` return type to non-Optional `Mapping`
3 changes: 2 additions & 1 deletion opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ def status(self) -> trace_api.Status:
return self._status

@property
def attributes(self) -> types.Attributes:
def attributes(self) -> Mapping[str, types.AttributeValue]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do / should we update the API definition too?

# `or {}` keeps the return non-None; see #4569.
return MappingProxyType(self._attributes or {})

@property
Expand Down