mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-01 05:51:16 +00:00
Merge pull request #2795 from WesleyAC/add-postgres-instrumentation
Add automatic instrumentation to Postgres queries
This commit is contained in:
commit
035ca6fec2
4 changed files with 9 additions and 0 deletions
|
@ -40,6 +40,7 @@ class BookwyrmConfig(AppConfig):
|
||||||
from bookwyrm.telemetry import open_telemetry
|
from bookwyrm.telemetry import open_telemetry
|
||||||
|
|
||||||
open_telemetry.instrumentDjango()
|
open_telemetry.instrumentDjango()
|
||||||
|
open_telemetry.instrumentPostgres()
|
||||||
|
|
||||||
if settings.ENABLE_PREVIEW_IMAGES and settings.FONTS:
|
if settings.ENABLE_PREVIEW_IMAGES and settings.FONTS:
|
||||||
# Download any fonts that we don't have yet
|
# Download any fonts that we don't have yet
|
||||||
|
|
|
@ -22,6 +22,12 @@ def instrumentDjango():
|
||||||
DjangoInstrumentor().instrument()
|
DjangoInstrumentor().instrument()
|
||||||
|
|
||||||
|
|
||||||
|
def instrumentPostgres():
|
||||||
|
from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
|
||||||
|
|
||||||
|
Psycopg2Instrumentor().instrument()
|
||||||
|
|
||||||
|
|
||||||
def instrumentCelery():
|
def instrumentCelery():
|
||||||
from opentelemetry.instrumentation.celery import CeleryInstrumentor
|
from opentelemetry.instrumentation.celery import CeleryInstrumentor
|
||||||
from celery.signals import worker_process_init
|
from celery.signals import worker_process_init
|
||||||
|
|
|
@ -11,3 +11,4 @@ class CelerywyrmConfig(AppConfig):
|
||||||
from bookwyrm.telemetry import open_telemetry
|
from bookwyrm.telemetry import open_telemetry
|
||||||
|
|
||||||
open_telemetry.instrumentCelery()
|
open_telemetry.instrumentCelery()
|
||||||
|
open_telemetry.instrumentPostgres()
|
||||||
|
|
|
@ -29,6 +29,7 @@ opentelemetry-api==1.16.0
|
||||||
opentelemetry-exporter-otlp-proto-grpc==1.16.0
|
opentelemetry-exporter-otlp-proto-grpc==1.16.0
|
||||||
opentelemetry-instrumentation-celery==0.37b0
|
opentelemetry-instrumentation-celery==0.37b0
|
||||||
opentelemetry-instrumentation-django==0.37b0
|
opentelemetry-instrumentation-django==0.37b0
|
||||||
|
opentelemetry-instrumentation-psycopg2==0.37b0
|
||||||
opentelemetry-sdk==1.16.0
|
opentelemetry-sdk==1.16.0
|
||||||
protobuf==3.20.*
|
protobuf==3.20.*
|
||||||
pyotp==2.8.0
|
pyotp==2.8.0
|
||||||
|
|
Loading…
Reference in a new issue