open-telemetry / open-telemetry/opentelemetry-python-contrib

Missing type stubs for instrumentation

Open
#3,021 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Describe your environment

OS: Void Linux
Python version: Python 3.12
SDK version: 1.28.1
API version: 1.28.1

What happened?

Pyright type checker complains about missing type stubs for

Stub file not found for "opentelemetry.instrumentation.asgi"

And

Stub file not found for "opentelemetry.instrumentation.sqlalchemy"

These are the two I checked presumably there could be more missing type stubs.

Steps to Reproduce

Just import

    from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware
    from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor

And run pyright in strict mode. Or use basedpyright that is strict by default.

Expected Result

No complaints from pyright about missing type stubs

Actual Result

complaints from pyright about missing type stubs

Additional context

No response

Would you like to implement a fix?

None

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

Start with the opentelemetry.instrumentation.asgi and opentelemetry.instrumentation.sqlalchemy modules named in the report, then reproduce the issue by importing OpenTelemetryMiddleware and SQLAlchemyInstrumentor and running Pyright in strict mode. Done means the reported instrumentation modules, and any additional missing stubs found during the check, no longer produce missing-stub complaints.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
backend, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.