Add automatic instrumentation to Postgres queries
This enables automatic instrumentation of Postgres queries when OpenTelemetry instrumentation is enabled, which will help with debugging performance problems.
This commit is contained in:
parent
4b1012b185
commit
61453d48e6
4 changed files with 9 additions and 0 deletions
|
@ -40,6 +40,7 @@ class BookwyrmConfig(AppConfig):
|
|||
from bookwyrm.telemetry import open_telemetry
|
||||
|
||||
open_telemetry.instrumentDjango()
|
||||
open_telemetry.instrumentPostgres()
|
||||
|
||||
if settings.ENABLE_PREVIEW_IMAGES and settings.FONTS:
|
||||
# Download any fonts that we don't have yet
|
||||
|
|
|
@ -22,6 +22,12 @@ def instrumentDjango():
|
|||
DjangoInstrumentor().instrument()
|
||||
|
||||
|
||||
def instrumentPostgres():
|
||||
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
|
||||
|
||||
Psycopg2Instrumentor().instrument()
|
||||
|
||||
|
||||
def instrumentCelery():
|
||||
from opentelemetry.instrumentation.celery import CeleryInstrumentor
|
||||
from celery.signals import worker_process_init
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue