open-telemetry / open-telemetry/opentelemetry-python

Add type hints to opentelemetry-sdk and run as a part of tests

Open
#1,608 22 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority:p2 style triaged
Dominant language
Python
Stars
2.6k
Forks
1k
Avg merge
4d 15h
Merged PRs (30d)
19

Description

Much of opentelemetry-sdk code doesn't have type hints. It would be great to add type hints and run the tests similar to opentelemetry-api.

  • exporter/opentelemetry-exporter-otlp-proto-common
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/init.py
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/_view_instrument_match.py
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar_reservoir.py
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/instrument.py
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/measurement_consumer.py
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/metric_reader_storage.py
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py
  • opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/view.py

In order to work on these please announce what are you going to tackle with a comment in this PR. In order to see the warnings to fix you need to include a path (for exporter/opentelemetry-exporter-otlp-proto-common) or remove a path (for the metrics) from the already excluded ones in pyright configuration in pyproject.toml. And make tox -e typecheck happy

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Choose one unchecked path from the issue, such as a metrics module or exporter/opentelemetry-exporter-otlp-proto-common, and inspect its exclusion in pyproject.toml. Adjust the relevant exclusion to expose warnings, then run tox -e typecheck; done means the selected path has type hints and the typecheck passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience, observability-sre, testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.