diff --git a/.github/workflows/core_contrib_test_0.yml b/.github/workflows/core_contrib_test_0.yml index cbe61bbf5e..c003de5050 100644 --- a/.github/workflows/core_contrib_test_0.yml +++ b/.github/workflows/core_contrib_test_0.yml @@ -877,8 +877,8 @@ jobs: - name: Run tests run: tox -e py38-test-instrumentation-requests -- -ra - py38-test-instrumentation-starlette: - name: instrumentation-starlette + py38-test-instrumentation-starlette-oldest: + name: instrumentation-starlette-oldest runs-on: ubuntu-latest steps: - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} @@ -897,7 +897,29 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py38-test-instrumentation-starlette -- -ra + run: tox -e py38-test-instrumentation-starlette-oldest -- -ra + + py38-test-instrumentation-starlette-latest: + name: instrumentation-starlette-latest + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py38-test-instrumentation-starlette-latest -- -ra py38-test-instrumentation-jinja2: name: instrumentation-jinja2 diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index e3128205c1..39850dd74f 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -286,8 +286,8 @@ jobs: - name: Run tests run: tox -e py313-test-instrumentation-requests -- -ra - py38-test-instrumentation-starlette_ubuntu-latest: - name: instrumentation-starlette 3.8 Ubuntu + py38-test-instrumentation-starlette-oldest_ubuntu-latest: + name: instrumentation-starlette-oldest 3.8 Ubuntu runs-on: ubuntu-latest steps: - name: Checkout repo @ SHA - ${{ github.sha }} @@ -302,10 +302,28 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py38-test-instrumentation-starlette -- -ra + run: tox -e py38-test-instrumentation-starlette-oldest -- -ra - py39-test-instrumentation-starlette_ubuntu-latest: - name: instrumentation-starlette 3.9 Ubuntu + py38-test-instrumentation-starlette-latest_ubuntu-latest: + name: instrumentation-starlette-latest 3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py38-test-instrumentation-starlette-latest -- -ra + + py39-test-instrumentation-starlette-oldest_ubuntu-latest: + name: instrumentation-starlette-oldest 3.9 Ubuntu runs-on: ubuntu-latest steps: - name: Checkout repo @ SHA - ${{ github.sha }} @@ -320,10 +338,46 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-instrumentation-starlette -- -ra + run: tox -e py39-test-instrumentation-starlette-oldest -- -ra - py310-test-instrumentation-starlette_ubuntu-latest: - name: instrumentation-starlette 3.10 Ubuntu + py39-test-instrumentation-starlette-latest_ubuntu-latest: + name: instrumentation-starlette-latest 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-instrumentation-starlette-latest -- -ra + + py310-test-instrumentation-starlette-oldest_ubuntu-latest: + name: instrumentation-starlette-oldest 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-instrumentation-starlette-oldest -- -ra + + py310-test-instrumentation-starlette-latest_ubuntu-latest: + name: instrumentation-starlette-latest 3.10 Ubuntu runs-on: ubuntu-latest steps: - name: Checkout repo @ SHA - ${{ github.sha }} @@ -338,10 +392,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-instrumentation-starlette -- -ra + run: tox -e py310-test-instrumentation-starlette-latest -- -ra - py311-test-instrumentation-starlette_ubuntu-latest: - name: instrumentation-starlette 3.11 Ubuntu + py311-test-instrumentation-starlette-oldest_ubuntu-latest: + name: instrumentation-starlette-oldest 3.11 Ubuntu runs-on: ubuntu-latest steps: - name: Checkout repo @ SHA - ${{ github.sha }} @@ -356,10 +410,46 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-instrumentation-starlette -- -ra + run: tox -e py311-test-instrumentation-starlette-oldest -- -ra - py312-test-instrumentation-starlette_ubuntu-latest: - name: instrumentation-starlette 3.12 Ubuntu + py311-test-instrumentation-starlette-latest_ubuntu-latest: + name: instrumentation-starlette-latest 3.11 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-instrumentation-starlette-latest -- -ra + + py312-test-instrumentation-starlette-oldest_ubuntu-latest: + name: instrumentation-starlette-oldest 3.12 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-instrumentation-starlette-oldest -- -ra + + py312-test-instrumentation-starlette-latest_ubuntu-latest: + name: instrumentation-starlette-latest 3.12 Ubuntu runs-on: ubuntu-latest steps: - name: Checkout repo @ SHA - ${{ github.sha }} @@ -374,10 +464,28 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py312-test-instrumentation-starlette -- -ra + run: tox -e py312-test-instrumentation-starlette-latest -- -ra + + py313-test-instrumentation-starlette-oldest_ubuntu-latest: + name: instrumentation-starlette-oldest 3.13 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-instrumentation-starlette-oldest -- -ra - py313-test-instrumentation-starlette_ubuntu-latest: - name: instrumentation-starlette 3.13 Ubuntu + py313-test-instrumentation-starlette-latest_ubuntu-latest: + name: instrumentation-starlette-latest 3.13 Ubuntu runs-on: ubuntu-latest steps: - name: Checkout repo @ SHA - ${{ github.sha }} @@ -392,10 +500,28 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py313-test-instrumentation-starlette -- -ra + run: tox -e py313-test-instrumentation-starlette-latest -- -ra + + pypy3-test-instrumentation-starlette-oldest_ubuntu-latest: + name: instrumentation-starlette-oldest pypy-3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.8 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.8" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-instrumentation-starlette-oldest -- -ra - pypy3-test-instrumentation-starlette_ubuntu-latest: - name: instrumentation-starlette pypy-3.8 Ubuntu + pypy3-test-instrumentation-starlette-latest_ubuntu-latest: + name: instrumentation-starlette-latest pypy-3.8 Ubuntu runs-on: ubuntu-latest steps: - name: Checkout repo @ SHA - ${{ github.sha }} @@ -410,7 +536,7 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e pypy3-test-instrumentation-starlette -- -ra + run: tox -e pypy3-test-instrumentation-starlette-latest -- -ra py38-test-instrumentation-jinja2_ubuntu-latest: name: instrumentation-jinja2 3.8 Ubuntu @@ -4389,129 +4515,3 @@ jobs: - name: Run tests run: tox -e py312-test-instrumentation-tornado -- -ra - - py313-test-instrumentation-tornado_ubuntu-latest: - name: instrumentation-tornado 3.13 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.13 - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py313-test-instrumentation-tornado -- -ra - - pypy3-test-instrumentation-tornado_ubuntu-latest: - name: instrumentation-tornado pypy-3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python pypy-3.8 - uses: actions/setup-python@v5 - with: - python-version: "pypy-3.8" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e pypy3-test-instrumentation-tornado -- -ra - - py38-test-instrumentation-tortoiseorm_ubuntu-latest: - name: instrumentation-tortoiseorm 3.8 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.8 - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py38-test-instrumentation-tortoiseorm -- -ra - - py39-test-instrumentation-tortoiseorm_ubuntu-latest: - name: instrumentation-tortoiseorm 3.9 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-instrumentation-tortoiseorm -- -ra - - py310-test-instrumentation-tortoiseorm_ubuntu-latest: - name: instrumentation-tortoiseorm 3.10 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-instrumentation-tortoiseorm -- -ra - - py311-test-instrumentation-tortoiseorm_ubuntu-latest: - name: instrumentation-tortoiseorm 3.11 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py311-test-instrumentation-tortoiseorm -- -ra - - py312-test-instrumentation-tortoiseorm_ubuntu-latest: - name: instrumentation-tortoiseorm 3.12 Ubuntu - runs-on: ubuntu-latest - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py312-test-instrumentation-tortoiseorm -- -ra diff --git a/.github/workflows/test_2.yml b/.github/workflows/test_2.yml index 3b796e31d5..4d6c81fe51 100644 --- a/.github/workflows/test_2.yml +++ b/.github/workflows/test_2.yml @@ -16,6 +16,132 @@ env: jobs: + py313-test-instrumentation-tornado_ubuntu-latest: + name: instrumentation-tornado 3.13 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-instrumentation-tornado -- -ra + + pypy3-test-instrumentation-tornado_ubuntu-latest: + name: instrumentation-tornado pypy-3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.8 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.8" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-instrumentation-tornado -- -ra + + py38-test-instrumentation-tortoiseorm_ubuntu-latest: + name: instrumentation-tortoiseorm 3.8 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py38-test-instrumentation-tortoiseorm -- -ra + + py39-test-instrumentation-tortoiseorm_ubuntu-latest: + name: instrumentation-tortoiseorm 3.9 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-instrumentation-tortoiseorm -- -ra + + py310-test-instrumentation-tortoiseorm_ubuntu-latest: + name: instrumentation-tortoiseorm 3.10 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-instrumentation-tortoiseorm -- -ra + + py311-test-instrumentation-tortoiseorm_ubuntu-latest: + name: instrumentation-tortoiseorm 3.11 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-instrumentation-tortoiseorm -- -ra + + py312-test-instrumentation-tortoiseorm_ubuntu-latest: + name: instrumentation-tortoiseorm 3.12 Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-instrumentation-tortoiseorm -- -ra + py313-test-instrumentation-tortoiseorm_ubuntu-latest: name: instrumentation-tortoiseorm 3.13 Ubuntu runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index a8ebe71151..b1e78dc46c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3273](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3273)) - Add `opentelemetry-instrumentation-vertexai>=2.0b0` to `opentelemetry-bootstrap` ([#3307](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3307)) +- Loosen `opentelemetry-instrumentation-starlette[instruments]` specifier + ([#3304](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3304)) ### Fixed diff --git a/instrumentation/README.md b/instrumentation/README.md index dcfcf46edd..5a87487773 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -43,7 +43,7 @@ | [opentelemetry-instrumentation-requests](./opentelemetry-instrumentation-requests) | requests ~= 2.0 | Yes | migration | [opentelemetry-instrumentation-sqlalchemy](./opentelemetry-instrumentation-sqlalchemy) | sqlalchemy >= 1.0.0, < 2.1.0 | Yes | experimental | [opentelemetry-instrumentation-sqlite3](./opentelemetry-instrumentation-sqlite3) | sqlite3 | No | experimental -| [opentelemetry-instrumentation-starlette](./opentelemetry-instrumentation-starlette) | starlette ~= 0.13.0 | Yes | experimental +| [opentelemetry-instrumentation-starlette](./opentelemetry-instrumentation-starlette) | starlette >= 0.13, <0.15 | Yes | experimental | [opentelemetry-instrumentation-system-metrics](./opentelemetry-instrumentation-system-metrics) | psutil >= 5 | No | experimental | [opentelemetry-instrumentation-threading](./opentelemetry-instrumentation-threading) | threading | No | experimental | [opentelemetry-instrumentation-tornado](./opentelemetry-instrumentation-tornado) | tornado >= 5.1.1 | Yes | experimental diff --git a/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml b/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml index acb61760a1..102f245395 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml @@ -34,9 +34,7 @@ dependencies = [ ] [project.optional-dependencies] -instruments = [ - "starlette ~= 0.13.0", -] +instruments = ["starlette >= 0.13, <0.15"] [project.entry-points.opentelemetry_instrumentor] starlette = "opentelemetry.instrumentation.starlette:StarletteInstrumentor" @@ -49,10 +47,7 @@ Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib" path = "src/opentelemetry/instrumentation/starlette/version.py" [tool.hatch.build.targets.sdist] -include = [ - "/src", - "/tests", -] +include = ["/src", "/tests"] [tool.hatch.build.targets.wheel] packages = ["src/opentelemetry"] diff --git a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/package.py b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/package.py index 11c3ed2e7b..ca95e754a8 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/package.py +++ b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/package.py @@ -13,6 +13,6 @@ # limitations under the License. -_instruments = ("starlette ~= 0.13.0",) +_instruments = ("starlette >= 0.13, <0.15",) _supports_metrics = True diff --git a/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in new file mode 100644 index 0000000000..15ff4892d5 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in @@ -0,0 +1,8 @@ +# Used to generate test-requirements.{oldest,latest}.txt with uv pip compile +pytest~=7.4 +requests~=2.32 +httpx~=0.28 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-asgi +-e util/opentelemetry-util-http +-e instrumentation/opentelemetry-instrumentation-starlette[instruments] diff --git a/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.latest.txt b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.latest.txt new file mode 100644 index 0000000000..7b6dd8cff4 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.latest.txt @@ -0,0 +1,98 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile --python 3.8 --universal --no-emit-package opentelemetry-api --no-emit-package opentelemetry-semantic-conventions -c dev-requirements.txt instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in -o instrumentation/opentelemetry-instrumentation-starlette/test-requirements.latest.txt +-e instrumentation/opentelemetry-instrumentation-asgi + # via + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in + # opentelemetry-instrumentation-starlette +-e instrumentation/opentelemetry-instrumentation-starlette + # via -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in +-e opentelemetry-instrumentation + # via + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in + # opentelemetry-instrumentation-asgi + # opentelemetry-instrumentation-starlette +-e util/opentelemetry-util-http + # via + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in + # opentelemetry-instrumentation-asgi + # opentelemetry-instrumentation-starlette +anyio==4.5.2 ; python_full_version < '3.9' + # via httpx +anyio==4.8.0 ; python_full_version >= '3.9' + # via httpx +asgiref==3.8.1 + # via opentelemetry-instrumentation-asgi +certifi==2025.1.31 + # via + # httpcore + # httpx + # requests +charset-normalizer==3.4.1 + # via requests +colorama==0.4.6 ; sys_platform == 'win32' + # via pytest +deprecated==1.2.18 + # via + # opentelemetry-api + # opentelemetry-semantic-conventions +exceptiongroup==1.2.2 ; python_full_version < '3.11' + # via + # anyio + # pytest +h11==0.14.0 + # via httpcore +httpcore==1.0.7 + # via httpx +httpx==0.28.1 + # via -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in +idna==3.10 + # via + # anyio + # httpx + # requests +importlib-metadata==8.5.0 ; python_full_version < '3.9' + # via opentelemetry-api +importlib-metadata==8.6.1 ; python_full_version >= '3.9' + # via opentelemetry-api +iniconfig==2.0.0 + # via pytest +packaging==24.2 + # via + # opentelemetry-instrumentation + # pytest +pluggy==1.5.0 + # via pytest +pytest==7.4.4 + # via + # -c dev-requirements.txt + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in +requests==2.32.3 + # via + # -c dev-requirements.txt + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in +sniffio==1.3.1 + # via anyio +starlette==0.14.2 + # via opentelemetry-instrumentation-starlette +tomli==2.2.1 ; python_full_version < '3.11' + # via pytest +typing-extensions==4.12.2 ; python_full_version < '3.13' + # via + # anyio + # asgiref +urllib3==2.2.3 ; python_full_version < '3.9' + # via requests +urllib3==2.3.0 ; python_full_version >= '3.9' + # via requests +wrapt==1.17.2 + # via + # deprecated + # opentelemetry-instrumentation +zipp==3.20.2 ; python_full_version < '3.9' + # via importlib-metadata +zipp==3.21.0 ; python_full_version >= '3.9' + # via importlib-metadata + +# The following packages were excluded from the output: +# opentelemetry-api +# opentelemetry-semantic-conventions diff --git a/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.oldest.txt b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.oldest.txt new file mode 100644 index 0000000000..5f84cdf28f --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.oldest.txt @@ -0,0 +1,98 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile --python 3.8 --universal --resolution lowest-direct --no-emit-package opentelemetry-api --no-emit-package opentelemetry-semantic-conventions -c dev-requirements.txt instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in -o instrumentation/opentelemetry-instrumentation-starlette/test-requirements.oldest.txt +-e instrumentation/opentelemetry-instrumentation-asgi + # via + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in + # opentelemetry-instrumentation-starlette +-e instrumentation/opentelemetry-instrumentation-starlette + # via -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in +-e opentelemetry-instrumentation + # via + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in + # opentelemetry-instrumentation-asgi + # opentelemetry-instrumentation-starlette +-e util/opentelemetry-util-http + # via + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in + # opentelemetry-instrumentation-asgi + # opentelemetry-instrumentation-starlette +anyio==4.5.2 ; python_full_version < '3.9' + # via httpx +anyio==4.8.0 ; python_full_version >= '3.9' + # via httpx +asgiref==3.8.1 + # via opentelemetry-instrumentation-asgi +certifi==2025.1.31 + # via + # httpcore + # httpx + # requests +charset-normalizer==3.4.1 + # via requests +colorama==0.4.6 ; sys_platform == 'win32' + # via pytest +deprecated==1.2.14 + # via + # opentelemetry-api + # opentelemetry-semantic-conventions +exceptiongroup==1.2.2 ; python_full_version < '3.11' + # via + # anyio + # pytest +h11==0.14.0 + # via httpcore +httpcore==1.0.7 + # via httpx +httpx==0.28.0 + # via -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in +idna==3.10 + # via + # anyio + # httpx + # requests +importlib-metadata==8.5.0 ; python_full_version < '3.9' + # via opentelemetry-api +importlib-metadata==8.6.1 ; python_full_version >= '3.9' + # via opentelemetry-api +iniconfig==2.0.0 + # via pytest +packaging==24.0 + # via + # opentelemetry-instrumentation + # pytest +pluggy==1.5.0 + # via pytest +pytest==7.4.4 + # via + # -c dev-requirements.txt + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in +requests==2.32.3 + # via + # -c dev-requirements.txt + # -r instrumentation/opentelemetry-instrumentation-starlette/test-requirements.in +sniffio==1.3.1 + # via anyio +starlette==0.13.8 + # via opentelemetry-instrumentation-starlette +tomli==2.2.1 ; python_full_version < '3.11' + # via pytest +typing-extensions==4.12.2 ; python_full_version < '3.13' + # via + # anyio + # asgiref +urllib3==2.2.3 ; python_full_version < '3.9' + # via requests +urllib3==2.3.0 ; python_full_version >= '3.9' + # via requests +wrapt==1.16.0 + # via + # deprecated + # opentelemetry-instrumentation +zipp==3.20.2 ; python_full_version < '3.9' + # via importlib-metadata +zipp==3.21.0 ; python_full_version >= '3.9' + # via importlib-metadata + +# The following packages were excluded from the output: +# opentelemetry-api +# opentelemetry-semantic-conventions diff --git a/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt deleted file mode 100644 index 3d756aa52e..0000000000 --- a/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt +++ /dev/null @@ -1,27 +0,0 @@ -anyio==4.3.0 -asgiref==3.8.1 -certifi==2024.7.4 -charset-normalizer==3.3.2 -Deprecated==1.2.14 -exceptiongroup==1.2.0 -h11==0.14.0 -httpcore==1.0.4 -httpx==0.27.0 -idna==3.7 -iniconfig==2.0.0 -packaging==24.0 -pluggy==1.5.0 -py-cpuinfo==9.0.0 -pytest==7.4.4 -requests==2.32.3 -sniffio==1.3.0 -starlette==0.13.8 -tomli==2.0.1 -typing_extensions==4.12.2 -urllib3==2.2.2 -wrapt==1.16.0 -zipp==3.19.2 --e opentelemetry-instrumentation --e instrumentation/opentelemetry-instrumentation-asgi --e util/opentelemetry-util-http --e instrumentation/opentelemetry-instrumentation-starlette diff --git a/instrumentation/opentelemetry-instrumentation-threading/src/opentelemetry/instrumentation/threading/__init__.py b/instrumentation/opentelemetry-instrumentation-threading/src/opentelemetry/instrumentation/threading/__init__.py index 18604d8596..0befa26165 100644 --- a/instrumentation/opentelemetry-instrumentation-threading/src/opentelemetry/instrumentation/threading/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-threading/src/opentelemetry/instrumentation/threading/__init__.py @@ -150,7 +150,7 @@ def __wrap_threading_run( token = context.attach(instance._otel_context) return call_wrapped(*args, **kwargs) finally: - context.detach(token) + context.detach(token) # type: ignore[reportArgumentType] remove with https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3321 @staticmethod def __wrap_thread_pool_submit( @@ -169,7 +169,7 @@ def wrapped_func(*func_args: Any, **func_kwargs: Any) -> R: token = context.attach(otel_context) return original_func(*func_args, **func_kwargs) finally: - context.detach(token) + context.detach(token) # type: ignore[reportArgumentType] remove with https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3321 # replace the original function with the wrapped function new_args: tuple[Callable[..., Any], ...] = (wrapped_func,) + args[1:] diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index 78dd70faa1..8162081932 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -185,7 +185,7 @@ "instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.52b0.dev", }, { - "library": "starlette ~= 0.13.0", + "library": "starlette >= 0.13, <0.15", "instrumentation": "opentelemetry-instrumentation-starlette==0.52b0.dev", }, { diff --git a/pyproject.toml b/pyproject.toml index 89f415d77c..f58229522f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -144,7 +144,7 @@ members = [ "propagator/*", "util/opentelemetry-util-http", ] -# TODO: remove after https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3300 +# TODO: remove after python 3.8 is dropped exclude = [ "instrumentation-genai/opentelemetry-instrumentation-google-genai", ] diff --git a/tox.ini b/tox.ini index 6f74535ae4..afcc054e0f 100644 --- a/tox.ini +++ b/tox.ini @@ -175,8 +175,8 @@ envlist = lint-instrumentation-requests ; opentelemetry-instrumentation-starlette - py3{8,9,10,11,12,13}-test-instrumentation-starlette - pypy3-test-instrumentation-starlette + py3{8,9,10,11,12,13}-test-instrumentation-starlette-{oldest,latest} + pypy3-test-instrumentation-starlette-{oldest,latest} lint-instrumentation-starlette ; opentelemetry-instrumentation-jinja2 @@ -612,7 +612,8 @@ deps = requests: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt starlette: {[testenv]test_deps} - starlette: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.txt + starlette-{oldest,lint}: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.oldest.txt + starlette-latest: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette/test-requirements.latest.txt system-metrics: {[testenv]test_deps} system-metrics: -r {toxinidir}/instrumentation/opentelemetry-instrumentation-system-metrics/test-requirements.txt diff --git a/uv.lock b/uv.lock index 11487f761e..c2b160252f 100644 --- a/uv.lock +++ b/uv.lock @@ -3773,7 +3773,7 @@ requires-dist = [ { name = "opentelemetry-instrumentation-asgi", editable = "instrumentation/opentelemetry-instrumentation-asgi" }, { name = "opentelemetry-semantic-conventions", git = "https://github.com/open-telemetry/opentelemetry-python?subdirectory=opentelemetry-semantic-conventions&branch=main" }, { name = "opentelemetry-util-http", editable = "util/opentelemetry-util-http" }, - { name = "starlette", marker = "extra == 'instruments'", specifier = "~=0.13.0" }, + { name = "starlette", marker = "extra == 'instruments'", specifier = ">=0.13,<0.15" }, ] provides-extras = ["instruments"]