mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-10-31 22:19:00 +00:00
Integrate open telemetry
This allows us to export to anyone that takes OTLP, which is most of the major players, I think! Nifty! Kinda like the S3 config but for tracing, you can slot in any provider that supports it via environment variables This uses the Django instrumentation, which gets us a bunch of nifty stuff right out of the box.
This commit is contained in:
parent
1c48605418
commit
8b4f93dd4e
2 changed files with 14 additions and 0 deletions
|
@ -10,9 +10,19 @@ https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
|
|||
import os
|
||||
from environs import Env
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
from opentelemetry.instrumentation.django import DjangoInstrumentor
|
||||
from opentelemetry import trace
|
||||
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
||||
from opentelemetry.sdk.trace import TracerProvider
|
||||
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
||||
|
||||
Env.read_env()
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bookwyrm.settings")
|
||||
DjangoInstrumentor().instrument()
|
||||
trace.set_tracer_provider(TracerProvider())
|
||||
trace.get_tracer_provider().add_span_processor(
|
||||
BatchSpanProcessor(OTLPSpanExporter())
|
||||
)
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
|
|
@ -18,3 +18,7 @@ django-rename-app==0.1.2
|
|||
pytz>=2021.1
|
||||
boto3==1.17.88
|
||||
django-storages==1.11.1
|
||||
opentelemetry-api
|
||||
opentelemetry-sdk
|
||||
opentelemetry-exporter-otlp-proto-grpc
|
||||
opentelemetry-instrumentation-django
|
||||
|
|
Loading…
Reference in a new issue