From 1d8286c08a13ef9687271a1e484630a380357b7b Mon Sep 17 00:00:00 2001 From: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com> Date: Thu, 7 Nov 2024 15:18:05 -0800 Subject: [PATCH 1/2] Update tests to work with SQLAlchemy 2 (#2976) --- .github/workflows/test_1.yml | 108 ++++++++++++++++++ CHANGELOG.md | 3 + .../test-requirements-2.txt | 13 +++ .../tests/test_sqlalchemy.py | 53 +++++---- .../tests/test_sqlcommenter.py | 17 +-- tox.ini | 6 +- 6 files changed, 167 insertions(+), 33 deletions(-) create mode 100644 instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-2.txt diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index 0b6aa766f2..227c891d0b 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -1492,6 +1492,24 @@ jobs: - name: Run tests run: tox -e py38-test-instrumentation-sqlalchemy-1 -- -ra + py38-test-instrumentation-sqlalchemy-2_ubuntu-latest: + name: instrumentation-sqlalchemy-2 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 + + - name: Run tests + run: tox -e py38-test-instrumentation-sqlalchemy-2 -- -ra + py39-test-instrumentation-sqlalchemy-1_ubuntu-latest: name: instrumentation-sqlalchemy-1 3.9 Ubuntu runs-on: ubuntu-latest @@ -1510,6 +1528,24 @@ jobs: - name: Run tests run: tox -e py39-test-instrumentation-sqlalchemy-1 -- -ra + py39-test-instrumentation-sqlalchemy-2_ubuntu-latest: + name: instrumentation-sqlalchemy-2 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 + + - name: Run tests + run: tox -e py39-test-instrumentation-sqlalchemy-2 -- -ra + py310-test-instrumentation-sqlalchemy-1_ubuntu-latest: name: instrumentation-sqlalchemy-1 3.10 Ubuntu runs-on: ubuntu-latest @@ -1528,6 +1564,24 @@ jobs: - name: Run tests run: tox -e py310-test-instrumentation-sqlalchemy-1 -- -ra + py310-test-instrumentation-sqlalchemy-2_ubuntu-latest: + name: instrumentation-sqlalchemy-2 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 + + - name: Run tests + run: tox -e py310-test-instrumentation-sqlalchemy-2 -- -ra + py311-test-instrumentation-sqlalchemy-1_ubuntu-latest: name: instrumentation-sqlalchemy-1 3.11 Ubuntu runs-on: ubuntu-latest @@ -1546,6 +1600,24 @@ jobs: - name: Run tests run: tox -e py311-test-instrumentation-sqlalchemy-1 -- -ra + py311-test-instrumentation-sqlalchemy-2_ubuntu-latest: + name: instrumentation-sqlalchemy-2 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 + + - name: Run tests + run: tox -e py311-test-instrumentation-sqlalchemy-2 -- -ra + py312-test-instrumentation-sqlalchemy-1_ubuntu-latest: name: instrumentation-sqlalchemy-1 3.12 Ubuntu runs-on: ubuntu-latest @@ -1564,6 +1636,24 @@ jobs: - name: Run tests run: tox -e py312-test-instrumentation-sqlalchemy-1 -- -ra + py312-test-instrumentation-sqlalchemy-2_ubuntu-latest: + name: instrumentation-sqlalchemy-2 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 + + - name: Run tests + run: tox -e py312-test-instrumentation-sqlalchemy-2 -- -ra + pypy3-test-instrumentation-sqlalchemy-0_ubuntu-latest: name: instrumentation-sqlalchemy-0 pypy-3.8 Ubuntu runs-on: ubuntu-latest @@ -1600,6 +1690,24 @@ jobs: - name: Run tests run: tox -e pypy3-test-instrumentation-sqlalchemy-1 -- -ra + pypy3-test-instrumentation-sqlalchemy-2_ubuntu-latest: + name: instrumentation-sqlalchemy-2 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 + + - name: Run tests + run: tox -e pypy3-test-instrumentation-sqlalchemy-2 -- -ra + py38-test-instrumentation-redis_ubuntu-latest: name: instrumentation-redis 3.8 Ubuntu runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index e1378d7ad9..c9718639d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `opentelemetry-instrumentation-sqlalchemy` Update unit tests to run with SQLALchemy 2 + ([#2976](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2976)) + ### Fixed ### Breaking changes diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-2.txt b/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-2.txt new file mode 100644 index 0000000000..757224a25b --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-2.txt @@ -0,0 +1,13 @@ +aiosqlite==0.20.0 +asgiref==3.8.1 +Deprecated==1.2.14 +greenlet==3.1.1 +iniconfig==2.0.0 +packaging==24.1 +pluggy==1.5.0 +pytest==7.4.4 +SQLAlchemy==2.0.36 +typing_extensions==4.12.2 +wrapt==1.16.0 +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-sqlalchemy diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py index f729fa6d80..957ae16237 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py @@ -17,7 +17,10 @@ import pytest import sqlalchemy -from sqlalchemy import create_engine +from sqlalchemy import ( + create_engine, + text, +) from opentelemetry import trace from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor @@ -43,12 +46,14 @@ def test_trace_integration(self): tracer_provider=self.tracer_provider, ) cnx = engine.connect() - cnx.execute("SELECT 1 + 1;").fetchall() - cnx.execute("/* leading comment */ SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() + cnx.execute(text("/* leading comment */ SELECT 1 + 1;")).fetchall() cnx.execute( - "/* leading comment */ SELECT 1 + 1; /* trailing comment */" + text( + "/* leading comment */ SELECT 1 + 1; /* trailing comment */" + ) ).fetchall() - cnx.execute("SELECT 1 + 1; /* trailing comment */").fetchall() + cnx.execute(text("SELECT 1 + 1; /* trailing comment */")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 5) @@ -76,9 +81,9 @@ def test_instrument_two_engines(self): ) cnx_1 = engine_1.connect() - cnx_1.execute("SELECT 1 + 1;").fetchall() + cnx_1.execute(text("SELECT 1 + 1;")).fetchall() cnx_2 = engine_2.connect() - cnx_2.execute("SELECT 1 + 1;").fetchall() + cnx_2.execute(text("SELECT 1 + 1;")).fetchall() spans = self.memory_exporter.get_finished_spans() # 2 queries + 2 engine connect @@ -111,7 +116,7 @@ async def run(): engine=engine.sync_engine, tracer_provider=self.tracer_provider ) async with engine.connect() as cnx: - await cnx.execute(sqlalchemy.text("SELECT 1 + 1;")) + await cnx.execute(text("SELECT 1 + 1;")) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 2) # first span - the connection to the db @@ -144,7 +149,7 @@ def test_not_recording(self): tracer_provider=self.tracer_provider, ) cnx = engine.connect() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() self.assertFalse(mock_span.is_recording()) self.assertTrue(mock_span.is_recording.called) self.assertFalse(mock_span.set_attribute.called) @@ -156,7 +161,7 @@ def test_create_engine_wrapper(self): engine = create_engine("sqlite:///:memory:") cnx = engine.connect() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 2) @@ -187,7 +192,7 @@ def test_create_engine_wrapper_enable_commenter(self): engine = create_engine("sqlite:///:memory:") cnx = engine.connect() - cnx.execute("SELECT 1;").fetchall() + cnx.execute(text("SELECT 1;")).fetchall() # sqlcommenter self.assertRegex( self.caplog.records[-2].getMessage(), @@ -207,7 +212,7 @@ def test_create_engine_wrapper_enable_commenter_otel_values_false(self): engine = create_engine("sqlite:///:memory:") cnx = engine.connect() - cnx.execute("SELECT 1;").fetchall() + cnx.execute(text("SELECT 1;")).fetchall() # sqlcommenter self.assertRegex( self.caplog.records[-2].getMessage(), @@ -233,7 +238,7 @@ def test_custom_tracer_provider(self): engine = create_engine("sqlite:///:memory:") cnx = engine.connect() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 2) @@ -258,7 +263,7 @@ async def run(): engine = create_async_engine("sqlite+aiosqlite:///:memory:") async with engine.connect() as cnx: - await cnx.execute(sqlalchemy.text("SELECT 1 + 1;")) + await cnx.execute(text("SELECT 1 + 1;")) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 2) # first span - the connection to the db @@ -299,7 +304,7 @@ async def run(): engine = create_async_engine("sqlite+aiosqlite:///:memory:") async with engine.connect() as cnx: - await cnx.execute(sqlalchemy.text("SELECT 1;")) + await cnx.execute(text("SELECT 1;")) # sqlcommenter self.assertRegex( self.caplog.records[1].getMessage(), @@ -330,7 +335,7 @@ async def run(): engine = create_async_engine("sqlite+aiosqlite:///:memory:") async with engine.connect() as cnx: - await cnx.execute(sqlalchemy.text("SELECT 1;")) + await cnx.execute(text("SELECT 1;")) # sqlcommenter self.assertRegex( self.caplog.records[1].getMessage(), @@ -346,7 +351,7 @@ def test_uninstrument(self): tracer_provider=self.tracer_provider, ) cnx = engine.connect() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 2) @@ -359,10 +364,10 @@ def test_uninstrument(self): self.memory_exporter.clear() SQLAlchemyInstrumentor().uninstrument() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() engine2 = create_engine("sqlite:///:memory:") cnx2 = engine2.connect() - cnx2.execute("SELECT 2 + 2;").fetchall() + cnx2.execute(text("SELECT 2 + 2;")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 0) @@ -371,7 +376,7 @@ def test_uninstrument(self): tracer_provider=self.tracer_provider, ) cnx = engine.connect() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 2) @@ -384,13 +389,13 @@ def test_uninstrument_without_engine(self): engine = create_engine("sqlite:///:memory:") cnx = engine.connect() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 2) self.memory_exporter.clear() SQLAlchemyInstrumentor().uninstrument() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 0) @@ -401,7 +406,7 @@ def test_no_op_tracer_provider(self): tracer_provider=trace.NoOpTracerProvider(), ) cnx = engine.connect() - cnx.execute("SELECT 1 + 1;").fetchall() + cnx.execute(text("SELECT 1 + 1;")).fetchall() spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 0) @@ -420,7 +425,7 @@ def make_shortlived_engine(): # collection weakref.finalize(engine, callback) with engine.connect() as conn: - conn.execute("SELECT 1 + 1;").fetchall() + conn.execute(text("SELECT 1 + 1;")).fetchall() for _ in range(0, 5): make_shortlived_engine() diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlcommenter.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlcommenter.py index f13c552bf4..ec2fc51e5b 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlcommenter.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlcommenter.py @@ -14,7 +14,10 @@ import logging import pytest -from sqlalchemy import create_engine +from sqlalchemy import ( + create_engine, + text, +) from opentelemetry import context from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor @@ -37,7 +40,7 @@ def test_sqlcommenter_disabled(self): engine=engine, tracer_provider=self.tracer_provider ) cnx = engine.connect() - cnx.execute("SELECT 1;").fetchall() + cnx.execute(text("SELECT 1;")).fetchall() self.assertEqual(self.caplog.records[-2].getMessage(), "SELECT 1;") @@ -50,7 +53,7 @@ def test_sqlcommenter_enabled(self): commenter_options={"db_framework": False}, ) cnx = engine.connect() - cnx.execute("SELECT 1;").fetchall() + cnx.execute(text("SELECT 1;")).fetchall() self.assertRegex( self.caplog.records[-2].getMessage(), r"SELECT 1 /\*db_driver='(.*)',traceparent='\d{1,2}-[a-zA-Z0-9_]{32}-[a-zA-Z0-9_]{16}-\d{1,2}'\*/;", @@ -68,7 +71,7 @@ def test_sqlcommenter_enabled_otel_values_false(self): }, ) cnx = engine.connect() - cnx.execute("SELECT 1;").fetchall() + cnx.execute(text("SELECT 1;")).fetchall() self.assertRegex( self.caplog.records[-2].getMessage(), r"SELECT 1 /\*db_driver='(.*)'\*/;", @@ -90,7 +93,7 @@ def test_sqlcommenter_flask_integration(self): ) context.attach(sqlcommenter_context) - cnx.execute("SELECT 1;").fetchall() + cnx.execute(text("SELECT 1;")).fetchall() self.assertRegex( self.caplog.records[-2].getMessage(), r"SELECT 1 /\*db_driver='(.*)',flask=1,traceparent='\d{1,2}-[a-zA-Z0-9_]{32}-[a-zA-Z0-9_]{16}-\d{1,2}'\*/;", @@ -105,7 +108,7 @@ def test_sqlcommenter_enabled_create_engine_after_instrumentation(self): engine = create_engine("sqlite:///:memory:") cnx = engine.connect() - cnx.execute("SELECT 1;").fetchall() + cnx.execute(text("SELECT 1;")).fetchall() self.assertRegex( self.caplog.records[-2].getMessage(), r"SELECT 1 /\*db_driver='(.*)',traceparent='\d{1,2}-[a-zA-Z0-9_]{32}-[a-zA-Z0-9_]{16}-\d{1,2}'\*/;", @@ -120,5 +123,5 @@ def test_sqlcommenter_disabled_create_engine_after_instrumentation(self): engine = create_engine("sqlite:///:memory:") cnx = engine.connect() - cnx.execute("SELECT 1;").fetchall() + cnx.execute(text("SELECT 1;")).fetchall() self.assertEqual(self.caplog.records[-2].getMessage(), "SELECT 1;") diff --git a/tox.ini b/tox.ini index 61a74427d0..cc5e509abc 100644 --- a/tox.ini +++ b/tox.ini @@ -263,8 +263,9 @@ envlist = ; below mean these dependencies are being used: ; 0: sqlalchemy>=1.1,<1.2 ; 1: sqlalchemy~=1.4 aiosqlite - py3{8,9,10,11,12}-test-instrumentation-sqlalchemy-{1} - pypy3-test-instrumentation-sqlalchemy-{0,1} + ; 2: sqlalchemy~=2.0.0 + py3{8,9,10,11,12}-test-instrumentation-sqlalchemy-{1,2} + pypy3-test-instrumentation-sqlalchemy-{0,1,2} lint-instrumentation-sqlalchemy ; opentelemetry-instrumentation-redis @@ -746,6 +747,7 @@ commands_pre = sqlalchemy: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils sqlalchemy-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-0.txt sqlalchemy-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-1.txt + sqlalchemy-2: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-2.txt lint-instrumentation-sqlalchemy: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlalchemy/test-requirements-1.txt elasticsearch: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api From 1d6968b672eeefda824daefd1f0238346287976f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Em=C3=ADdio=20Neto?= <9735060+emdneto@users.noreply.github.com> Date: Thu, 7 Nov 2024 20:39:16 -0300 Subject: [PATCH 2/2] fix: teach instrument version constraint for sqlalchemy (#2971) --- CHANGELOG.md | 2 ++ instrumentation/README.md | 2 +- .../opentelemetry-instrumentation-sqlalchemy/pyproject.toml | 2 +- .../src/opentelemetry/instrumentation/sqlalchemy/package.py | 2 +- .../src/opentelemetry/instrumentation/bootstrap_gen.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9718639d7..6be2429f06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Breaking changes +- `opentelemetry-instrumentation-sqlalchemy` teach instruments version + ([#2971](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2971)) - Drop `opentelemetry-instrumentation-test` package from default instrumentation list ([#2969](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2969)) diff --git a/instrumentation/README.md b/instrumentation/README.md index b87bf6f844..fb601266ea 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -39,7 +39,7 @@ | [opentelemetry-instrumentation-redis](./opentelemetry-instrumentation-redis) | redis >= 2.6 | No | experimental | [opentelemetry-instrumentation-remoulade](./opentelemetry-instrumentation-remoulade) | remoulade >= 0.50 | No | experimental | [opentelemetry-instrumentation-requests](./opentelemetry-instrumentation-requests) | requests ~= 2.0 | Yes | migration -| [opentelemetry-instrumentation-sqlalchemy](./opentelemetry-instrumentation-sqlalchemy) | sqlalchemy | Yes | experimental +| [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-system-metrics](./opentelemetry-instrumentation-system-metrics) | psutil >= 5 | No | experimental diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml b/instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml index f8ce651b6c..d6d8c7aff9 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ [project.optional-dependencies] instruments = [ - "sqlalchemy", + "sqlalchemy >= 1.0.0, < 2.1.0", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/package.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/package.py index e3029f57b6..77b148e51c 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/package.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/package.py @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -_instruments = ("sqlalchemy",) +_instruments = ("sqlalchemy >= 1.0.0, < 2.1.0",) _supports_metrics = True diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index 1100a5c51b..2e7b5532f3 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -161,7 +161,7 @@ "instrumentation": "opentelemetry-instrumentation-requests==0.50b0.dev", }, { - "library": "sqlalchemy", + "library": "sqlalchemy >= 1.0.0, < 2.1.0", "instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.50b0.dev", }, {