mirror of
https://github.com/makeplane/plane.git
synced 2026-09-02 03:59:00 +02:00
feat(api/observability): bootstrap OpenTelemetry in wsgi/asgi/manage entry points
This commit is contained in:
@@ -8,6 +8,13 @@ import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plane.settings.production")
|
||||
|
||||
# Bootstrap OpenTelemetry before Django imports so runserver and
|
||||
# management commands are instrumented too. No-op unless OTEL_ENABLED=1.
|
||||
from plane.observability.setup import configure_otel
|
||||
|
||||
configure_otel()
|
||||
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
|
||||
import os
|
||||
|
||||
from channels.routing import ProtocolTypeRouter
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
django_asgi_app = get_asgi_application()
|
||||
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plane.settings.production")
|
||||
|
||||
# Bootstrap OpenTelemetry before Django wires up so DjangoInstrumentor can
|
||||
# patch the ASGI handler. No-op unless OTEL_ENABLED=1.
|
||||
from plane.observability.setup import configure_otel # noqa: E402
|
||||
|
||||
configure_otel()
|
||||
|
||||
from channels.routing import ProtocolTypeRouter # noqa: E402
|
||||
from django.core.asgi import get_asgi_application # noqa: E402
|
||||
|
||||
# Initialize Django ASGI application early to ensure the AppRegistry
|
||||
# is populated before importing code that may import ORM models.
|
||||
|
||||
|
||||
application = ProtocolTypeRouter({"http": get_asgi_application()})
|
||||
|
||||
@@ -11,8 +11,14 @@ It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plane.settings.production")
|
||||
|
||||
# Bootstrap OpenTelemetry before Django wires up so DjangoInstrumentor can
|
||||
# patch the WSGI handler. No-op unless OTEL_ENABLED=1.
|
||||
from plane.observability.setup import configure_otel # noqa: E402
|
||||
|
||||
configure_otel()
|
||||
|
||||
from django.core.wsgi import get_wsgi_application # noqa: E402
|
||||
|
||||
application = get_wsgi_application()
|
||||
|
||||
Reference in New Issue
Block a user