Fix OpenTelemetry initialization - remove ENABLE_OPENTELEMETRY dependency

- Always initialize OpenTelemetry in Django settings (instrumentation always enabled)
- Remove ENABLE_OPENTELEMETRY feature flag from config.py
- Simplify views.py OpenTelemetry imports to always use real implementation
- Export control now handled by OTEL_EXPORT_ENABLED environment variable only

This ensures OpenTelemetry is properly initialized during Django startup
and the Prometheus metrics server starts correctly.
This commit is contained in:
Oliver Falk
2025-10-17 14:43:05 +02:00
parent c17b078913
commit 8e61f02702
4 changed files with 87 additions and 48 deletions

View File

@@ -316,13 +316,6 @@ ENABLE_MALICIOUS_CONTENT_SCAN = True
# Logging configuration - can be overridden in local config
# Example: LOGS_DIR = "/var/log/ivatar" # For production deployments
# OpenTelemetry feature flag - can be disabled for F/LOSS deployments
ENABLE_OPENTELEMETRY = os.environ.get("ENABLE_OPENTELEMETRY", "false").lower() in (
"true",
"1",
"yes",
)
# This MUST BE THE LAST!
if os.path.isfile(os.path.join(BASE_DIR, "config_local.py")):
from config_local import * # noqa # flake8: noqa # NOQA # pragma: no cover