Skip to content

opentelemetry-sdk: fix typing issues for metrics instruments#5082

Open
xrmx wants to merge 2 commits intoopen-telemetry:mainfrom
xrmx:fix-metrics-instrument-sdk-typing
Open

opentelemetry-sdk: fix typing issues for metrics instruments#5082
xrmx wants to merge 2 commits intoopen-telemetry:mainfrom
xrmx:fix-metrics-instrument-sdk-typing

Conversation

@xrmx
Copy link
Copy Markdown
Contributor

@xrmx xrmx commented Apr 13, 2026

Description

This solves 19 issues reported by pyright but not does not make any module clean so list of the excluded files is not updated.

Refs #1608

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

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 13, 2026
@xrmx xrmx requested a review from a team as a code owner April 13, 2026 11:11
Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

🚀

@github-project-automation github-project-automation bot moved this to Approved PRs in Python PR digest Apr 13, 2026
Comment thread opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/instrument.py Outdated
Comment thread opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/instrument.py Outdated


class _Synchronous:
class _Instrument:
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.

I don't think this makes pyright enforce that _Synchronous properly implements _Instrument, you would want to make this a protocol.

playground example

Copy link
Copy Markdown
Contributor Author

@xrmx xrmx Apr 15, 2026

Choose a reason for hiding this comment

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

With a protocol the playground example seems to work

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

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

Status: Approved PRs

Development

Successfully merging this pull request may close these issues.

4 participants