mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 11:10: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:
@ -163,10 +163,12 @@ def setup_instruments(db_engine: str): # pragma: no cover
|
|||||||
RequestsInstrumentor().instrument()
|
RequestsInstrumentor().instrument()
|
||||||
SystemMetricsInstrumentor().instrument()
|
SystemMetricsInstrumentor().instrument()
|
||||||
|
|
||||||
|
db_engine = str(db_engine).lower().strip()
|
||||||
|
|
||||||
# DBs
|
# DBs
|
||||||
if db_engine == 'sqlite':
|
if 'sqlite' in db_engine:
|
||||||
SQLite3Instrumentor().instrument()
|
SQLite3Instrumentor().instrument()
|
||||||
elif db_engine == 'postgresql':
|
elif 'postgresql' in db_engine:
|
||||||
try:
|
try:
|
||||||
from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor
|
from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor
|
||||||
|
|
||||||
@ -175,7 +177,7 @@ def setup_instruments(db_engine: str): # pragma: no cover
|
|||||||
)
|
)
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
pass
|
pass
|
||||||
elif db_engine == 'mysql':
|
elif 'mysql' in db_engine:
|
||||||
try:
|
try:
|
||||||
from opentelemetry.instrumentation.pymysql import PyMySQLInstrumentor
|
from opentelemetry.instrumentation.pymysql import PyMySQLInstrumentor
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user