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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- `opentelemetry-sdk`: tighten `ReadableSpan.attributes` annotation to non-Optional `Mapping` so callers don't need `assert ... is not None` boilerplate; runtime guarantee was already in place via `MappingProxyType(self._attributes or {})`
([#5183](https://github.com/open-telemetry/opentelemetry-python/pull/5183))
- Apply fixes for `UP` ruff rule
([#5133](https://github.com/open-telemetry/opentelemetry-python/pull/5133))
- Switch to SPDX license headers and add CI enforcement
([#5177](https://github.com/open-telemetry/opentelemetry-python/pull/5177))
- `opentelemetry-api`: Enforce W3C Baggage size limits on outbound propagation in `W3CBaggagePropagator.inject()`. Previously only inbound extraction enforced limits; now inject also caps entries at 180, individual pairs at 4096 bytes, and total header at 8192 bytes per the W3C Baggage spec. The extract path max_pairs limit now counts all size-valid entries rather than only successfully parsed ones.
([#5163](https://github.com/open-telemetry/opentelemetry-python/pull/5163))
- `opentelemetry-sdk`: add `additional_properties` support to generated config models via custom `datamodel-codegen` template, enabling plugin/custom component names to flow through typed dataclasses
Expand Down Expand Up @@ -42,6 +48,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#5135](https://github.com/open-telemetry/opentelemetry-python/pull/5135))
- ci: wait for tracecontext server readiness instead of a fixed sleep in `scripts/tracecontext-integration-test.sh`
([#5149](https://github.com/open-telemetry/opentelemetry-python/pull/5149))
- `opentelemetry-api`: update `EnvironmentGetter` and `EnvironmentSetter` to use normalized environment variable names
([#5119](https://github.com/open-telemetry/opentelemetry-python/pull/5119))
- `opentelemetry-sdk`: only load entrypoints for resource detectors if they are configured via `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS`
([#5145](https://github.com/open-telemetry/opentelemetry-python/pull/5145))
- `opentelemetry-exporter-otlp-json-common`: add 'opentelemetry-exporter-otlp-json-common' package for OTLP JSON exporters
([#4996](https://github.com/open-telemetry/opentelemetry-python/pull/4996))
- `opentelemetry-exporter-otlp-proto-grpc`: make retryable gRPC error codes configurable for gRPC exporters
([#4917](https://github.com/open-telemetry/opentelemetry-python/pull/4917))

## Version 1.41.0/0.62b0 (2026-04-09)

Expand Down
7 changes: 6 additions & 1 deletion opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,12 @@ def status(self) -> trace_api.Status:
return self._status

@property
def attributes(self) -> types.Attributes:
def attributes(self) -> Mapping[str, types.AttributeValue]:
# The implementation always returns a MappingProxyType, never None,
# because `self._attributes or {}` falls back to an empty dict.
# Tightening the return annotation fixes type-checker complaints
# like `Object of type "None" is not subscriptable` when callers
# do `span.attributes["key"]`. See issue #4569.
return MappingProxyType(self._attributes or {})

@property
Expand Down