python-neva 2.2.1__py3-none-any.whl → 2.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- neva/database/manager.py +2 -0
- neva/obs/instrumentation/__init__.py +1 -0
- neva/obs/instrumentation/sqlalchemy.py +15 -0
- {python_neva-2.2.1.dist-info → python_neva-2.3.0.dist-info}/METADATA +2 -1
- {python_neva-2.2.1.dist-info → python_neva-2.3.0.dist-info}/RECORD +6 -4
- {python_neva-2.2.1.dist-info → python_neva-2.3.0.dist-info}/WHEEL +0 -0
neva/database/manager.py
CHANGED
|
@@ -10,6 +10,7 @@ from neva import Nothing, Option, Some
|
|
|
10
10
|
from neva.database.connection import ConnectionManager, TransactionContext
|
|
11
11
|
from neva.database.transaction import BoundTransaction, Transaction
|
|
12
12
|
from neva.obs import LogManager
|
|
13
|
+
from neva.obs.instrumentation.sqlalchemy import instrument
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
@final
|
|
@@ -30,6 +31,7 @@ class DatabaseManager:
|
|
|
30
31
|
name: The connection name.
|
|
31
32
|
engine: The async engine.
|
|
32
33
|
"""
|
|
34
|
+
instrument(engine)
|
|
33
35
|
self._engines[name] = engine
|
|
34
36
|
self._session_factories[name] = async_sessionmaker(
|
|
35
37
|
bind=engine,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Various OTel instrumentation."""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""SQLAlchemy instrumentation."""
|
|
2
|
+
|
|
3
|
+
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
|
4
|
+
from sqlalchemy import Engine
|
|
5
|
+
from sqlalchemy.ext.asyncio import AsyncEngine
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def instrument(engine: AsyncEngine | Engine) -> None:
|
|
9
|
+
"""Instrument SQLAlchemy engine."""
|
|
10
|
+
match engine:
|
|
11
|
+
case AsyncEngine():
|
|
12
|
+
to_instrument = engine.sync_engine
|
|
13
|
+
case Engine():
|
|
14
|
+
to_instrument = engine
|
|
15
|
+
SQLAlchemyInstrumentor().instrument(engine=to_instrument)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-neva
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.12
|
|
6
6
|
Requires-Dist: aiosqlite>=0.20.0
|
|
@@ -9,6 +9,7 @@ Requires-Dist: cryptography>=46.0.3
|
|
|
9
9
|
Requires-Dist: dishka>=1.7.2
|
|
10
10
|
Requires-Dist: fastapi[all]>=0.129.0
|
|
11
11
|
Requires-Dist: faststream>=0.6.6
|
|
12
|
+
Requires-Dist: opentelemetry-instrumentation-sqlalchemy>=0.62b0
|
|
12
13
|
Requires-Dist: pwdlib[argon2,bcrypt]>=0.3.0
|
|
13
14
|
Requires-Dist: pyinstrument>=5.1.1
|
|
14
15
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.0
|
|
@@ -14,7 +14,7 @@ neva/config/repository.py,sha256=B7iWgJLtOIwdmp7I0y9ISgl3g_Xc60tUe-ofDUKM6fg,482
|
|
|
14
14
|
neva/database/__init__.py,sha256=3yYnEe8HQM86tURyAhTbMtE7AXubIEMN3GuwxkkT-bk,508
|
|
15
15
|
neva/database/config.py,sha256=bVKUqlrYDFrURqg_FbntPXyVkbOUPSVXQJTKjyucjL0,451
|
|
16
16
|
neva/database/connection.py,sha256=et1fvGxa2iHTJ8yzAv9VIYqfD4GtGaV0KQUW97SdLHQ,7107
|
|
17
|
-
neva/database/manager.py,sha256=
|
|
17
|
+
neva/database/manager.py,sha256=tQFHj2HZzo3oxdWyWNQlv5277I7vh7vDlEEiUyAKjDs,4511
|
|
18
18
|
neva/database/provider.py,sha256=R-K4aFCgF8Ewu6I_-BXo874IYgQgI3b8qYPsGe7ArFA,1785
|
|
19
19
|
neva/database/transaction.py,sha256=yQuFDhdXipUWac3zx4rVy6R6XUB_xPT_CLoQ-26223Y,5933
|
|
20
20
|
neva/events/__init__.py,sha256=xwIAXNcOASpuCY4DJpshZc1gtxQHimzwy-s7c-4QuiQ,746
|
|
@@ -24,6 +24,8 @@ neva/events/event_registry.py,sha256=jucYOUjCERz-ICdPiDrxYw_ySvmPJOcRzYKCgka29qY
|
|
|
24
24
|
neva/events/listener.py,sha256=AMfi24R_WA_-mVg0fxfOrwY6EV8kO1wU5YpAFPvGrus,1825
|
|
25
25
|
neva/events/provider.py,sha256=ilPW_-zaLMrh-cgWphLe_aqvs00LNp93OOMFFpIppyE,767
|
|
26
26
|
neva/obs/__init__.py,sha256=dVzgljk9Hvo44LI34RcwbDyT42_z4nSnFVmL4GLbKD0,331
|
|
27
|
+
neva/obs/instrumentation/__init__.py,sha256=SfIAvuCs-L0kEzOxUJ4aOIkhbydCe7qBwWtGeDELVA0,36
|
|
28
|
+
neva/obs/instrumentation/sqlalchemy.py,sha256=kwk43NthFi4mPMhDJI55rxt9YPOY_mwOkr2E-cD64ZY,497
|
|
27
29
|
neva/obs/logging/__init__.py,sha256=gIYBAzMK7-wPGEpA_kYKvJPT3hYN99OcCc9UuHFeiHk,251
|
|
28
30
|
neva/obs/logging/manager.py,sha256=ktd3muBGU3e1KuBK6tSU5faRJRliPwmknuqJ2EYeFBk,2422
|
|
29
31
|
neva/obs/logging/provider.py,sha256=lt5oma5eV6mjN4C5iFhyYf0BmI9BMbFVBJJNSy2XOkg,638
|
|
@@ -72,6 +74,6 @@ neva/testing/fakes.py,sha256=ffAAZC7WymuutVYk3vefuPDUvpNHav2QV2lj-Gw0Kic,2666
|
|
|
72
74
|
neva/testing/fixtures.py,sha256=-l_Drw6nXTD_cKpfg1Z1pmsXnaD3NM2kihdRHxSkfzE,1657
|
|
73
75
|
neva/testing/http.py,sha256=9oKNzaz38nCKkL-ZUF5CRWFPqpNmXkqbYcoukC509_Q,494
|
|
74
76
|
neva/testing/test_case.py,sha256=FzXBHctkVkFNu46S5lnt7iRX91TLPLfL1Lzgn-iU-_E,3325
|
|
75
|
-
python_neva-2.
|
|
76
|
-
python_neva-2.
|
|
77
|
-
python_neva-2.
|
|
77
|
+
python_neva-2.3.0.dist-info/METADATA,sha256=woz2CCGwVG7vPpl7C6tGjv2634D5iwO4WPeXzrPk8mw,691
|
|
78
|
+
python_neva-2.3.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
79
|
+
python_neva-2.3.0.dist-info/RECORD,,
|
|
File without changes
|