Skip to content

Fixed ReadableSpan.attributes to return Mapping[str, AnyValue] - #5965

Closed
Bhupendra-glitch wants to merge 1 commit into
open-telemetry:mainfrom
Bhupendra-glitch:main
Closed

Bhupendra-glitch wants to merge 1 commit into
open-telemetry:mainfrom
Bhupendra-glitch:main

Conversation

@Bhupendra-glitch

@Bhupendra-glitch Bhupendra-glitch commented Nov 25, 2026 •

Copy link
Copy Markdown

Description

Updates the return type annotation of ReadableSpan.attributes in opentelemetry-sdk from types.Attributes to Mapping[str, types.AnyValue] (while returning a MappingProxyType over self._attributes or {}), and adds a type assertion test in TestReadableSpan using assert_type to verify the inferred return type.

Fixes #5955

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • I am a human and not a bot
  • I have run tox -e precommit
  • I have run tox -e typecheck
  • I have run the relevant tests and linting tox environments
  • This requires the following PR in contrib:

@Bhupendra-glitch
Bhupendra-glitch requested a review from a team as a code owner November 25, 2026 06:03
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Closed · refreshed 2026-11-26 14:15 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@Bhupendra-glitch

Copy link
Copy Markdown
Author

Thanks for opening this PR to fix #5955 and adding an assert_type test in TestReadableSpan. The change from types.Attributes to Mapping[str, types.AnyValue] with MappingProxyType looks clean. Flagging for maintainer review and workflow approval so the checks can run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bug: uncorrect typehint for ReadableSpan.attributes

2 participants