All checks were successful
Build And Test / build-and-push (push) Successful in 2m0s
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
"""
|
|
WSGI config for auth_prj project.
|
|
|
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
|
|
"""
|
|
|
|
import os
|
|
|
|
# ✅ Django 설정을 미리 불러온다
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'butler_ddochi.settings')
|
|
|
|
from django.conf import settings
|
|
from django.core.wsgi import get_wsgi_application
|
|
|
|
# os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'auth_prj.settings')
|
|
|
|
# ✅ DEBUG 모드 아닐 때만 OpenTelemetry 활성
|
|
if not settings.DEBUG:
|
|
from opentelemetry import trace
|
|
from opentelemetry.sdk.resources import Resource
|
|
from opentelemetry.sdk.trace import TracerProvider
|
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
from opentelemetry.instrumentation.django import DjangoInstrumentor
|
|
|
|
trace.set_tracer_provider(
|
|
TracerProvider(
|
|
resource=Resource.create({
|
|
"service.name": "msa-django-auth",
|
|
})
|
|
)
|
|
)
|
|
|
|
otlp_exporter = OTLPSpanExporter(
|
|
endpoint="http://jaeger-collector.istio-system:4317",
|
|
insecure=True,
|
|
)
|
|
|
|
trace.get_tracer_provider().add_span_processor(
|
|
BatchSpanProcessor(otlp_exporter)
|
|
)
|
|
|
|
DjangoInstrumentor().instrument()
|
|
|
|
|
|
from django.core.wsgi import get_wsgi_application
|
|
|
|
application = get_wsgi_application()
|