bookwyrm/celerywyrm/apps.py
Wesley Aptekar-Cassels 61453d48e6 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.
2023-04-07 01:58:49 -04:00

14 lines
422 B
Python

from django.apps import AppConfig
from celerywyrm import settings
class CelerywyrmConfig(AppConfig):
name = "celerywyrm"
verbose_name = "BookWyrm Celery"
def ready(self):
if settings.OTEL_EXPORTER_OTLP_ENDPOINT or settings.OTEL_EXPORTER_CONSOLE:
from bookwyrm.telemetry import open_telemetry
open_telemetry.instrumentCelery()
open_telemetry.instrumentPostgres()