Skip to content

Commit 6b96015

Browse files
committed
review: switch to towncrier fragment + tighten docstring (open-telemetry#5183)
Signed-off-by: WatchTree-19 <119982314+WatchTree-19@users.noreply.github.com>
1 parent 97d0d2a commit 6b96015

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

.changelog/5183.changed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`opentelemetry-sdk`: tighten `ReadableSpan.attributes` return type to non-Optional `Mapping`

CHANGELOG.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
<!--
6+
Do *NOT* add changelog entries here!
7+
8+
This changelog is managed by towncrier and is compiled at release time.
9+
10+
See https://github.com/open-telemetry/opentelemetry-python/blob/main/CONTRIBUTING.md#changelog for details.
11+
-->
12+
513
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
614
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
715

@@ -10,10 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1018
> [!IMPORTANT]
1119
> We are working on stabilizing the Log signal that would require making deprecations and breaking changes. We will try to reduce the releases that may require an update to your code, especially for instrumentations or for sdk developers.
1220

21+
<!-- changelog start -->
22+
1323
## Unreleased
1424

15-
- `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 {})`
16-
([#5183](https://github.com/open-telemetry/opentelemetry-python/pull/5183))
25+
- `opentelemetry-sdk`: fix multi-processor `force_flush` skipping remaining processors when one returns `None`
26+
([#5179](https://github.com/open-telemetry/opentelemetry-python/pull/5179))
1727
- Apply fixes for `UP` ruff rule
1828
([#5133](https://github.com/open-telemetry/opentelemetry-python/pull/5133))
1929
- Switch to SPDX license headers and add CI enforcement
@@ -56,6 +66,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5666
([#4996](https://github.com/open-telemetry/opentelemetry-python/pull/4996))
5767
- `opentelemetry-exporter-otlp-proto-grpc`: make retryable gRPC error codes configurable for gRPC exporters
5868
([#4917](https://github.com/open-telemetry/opentelemetry-python/pull/4917))
69+
- `opentelemetry-sdk`: add sampler plugin loading to declarative file configuration via the `opentelemetry_sampler` entry point group, matching the spec's PluginComponentProvider mechanism
70+
([#5095](https://github.com/open-telemetry/opentelemetry-python/pull/5095))
71+
- Add `registry` keyword argument to `PrometheusMetricReader` to allow passing a custom Prometheus registry
72+
([#5055](https://github.com/open-telemetry/opentelemetry-python/pull/5055))
73+
- Add ability to selectively enable exporting of SDK internal metrics with the `OTEL_PYTHON_SDK_INTERNAL_METRICS_ENABLED` environment variable.
74+
([#5151](https://github.com/open-telemetry/opentelemetry-python/pull/5151))
75+
- `opentelemetry-api`, `opentelemetry-sdk`: add support for 'random-trace-id' flags in W3C traceparent header trace flags. Implementations of `IdGenerator` that do randomly generate the 56 least significant bits, should also implement a `is_trace_id_random` methods that returns `True`.
76+
([#4854](https://github.com/open-telemetry/opentelemetry-python/pull/4854))
5977

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

opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,7 @@ def status(self) -> trace_api.Status:
498498

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

508504
@property

0 commit comments

Comments
 (0)