2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Tweak for tracing setup (#9865)

- DB_ENGINE is of the form "django.db.backends.postgresql", not "postgesql"
This commit is contained in:
Oliver
2025-06-26 09:29:03 +10:00
committed by GitHub
parent 2738d286de
commit 1b0de3610f

View File

@ -163,10 +163,12 @@ def setup_instruments(db_engine: str): # pragma: no cover
RequestsInstrumentor().instrument()
SystemMetricsInstrumentor().instrument()
db_engine = str(db_engine).lower().strip()
# DBs
if db_engine == 'sqlite':
if 'sqlite' in db_engine:
SQLite3Instrumentor().instrument()
elif db_engine == 'postgresql':
elif 'postgresql' in db_engine:
try:
from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor
@ -175,7 +177,7 @@ def setup_instruments(db_engine: str): # pragma: no cover
)
except ModuleNotFoundError:
pass
elif db_engine == 'mysql':
elif 'mysql' in db_engine:
try:
from opentelemetry.instrumentation.pymysql import PyMySQLInstrumentor