Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ pyvenv.cfg
# Certificate files
*.pem

# Override overlay (opt-in, copied from .example)
docker-compose.override.yml

# RADIS specific
backups/
models/
21 changes: 21 additions & 0 deletions docker-compose.override.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
x-observability: &observability
networks:
- default
- openradx-observability
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-}
OTEL_PYTHON_DJANGO_EXCLUDED_URLS: "health/,static/.*"

networks:
openradx-observability:
external: true

services:
init:
<<: *observability
web:
<<: *observability
default_worker:
<<: *observability
llm_worker:
<<: *observability
5 changes: 5 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ REPORT_LLM_PROVIDER_URL="http://host.docker.internal:11434/v1"
# 'cli generate-example-reports'.
REPORT_LLM_PROVIDER_API_KEY="ollama"

# OpenTelemetry Configuration
# Set this to the OTLP HTTP endpoint of the centralized openradx-observability stack.
# See https://github.com/openradx/openradx-observability for setup instructions.
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector.local:4318

# Docker swarm mode does not respect the Docker Proxy client configuration
# (see https://docs.docker.com/network/proxy/#configure-the-docker-client),
# but we can set those environment variables manually.
Expand Down
5 changes: 5 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def initialize_debugger():
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "radis.settings.development")

# Initialize OpenTelemetry before Django loads to ensure all requests are traced
from adit_radis_shared.telemetry import setup_opentelemetry

setup_opentelemetry()

initialize_debugger()

try:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version = "0.0.0"
readme = "README.md"
requires-python = ">=3.12,<4.0"
dependencies = [
"adit-radis-shared @ git+https://github.com/openradx/adit-radis-shared.git@0.19.1",
"adit-radis-shared @ git+https://github.com/openradx/adit-radis-shared.git@0.20.0",
"adrf>=0.1.9",
"aiofiles>=24.1.0",
"asyncinotify>=4.2.0",
Expand Down
10 changes: 8 additions & 2 deletions radis/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "radis.settings.development")

# Initialize OpenTelemetry before Django loads to ensure all requests are traced
from adit_radis_shared.telemetry import setup_opentelemetry # noqa: E402

setup_opentelemetry()

from django.core.asgi import get_asgi_application # noqa: E402
Comment on lines +18 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unused # noqa: E402 directives (RUF100).

Ruff reports these as unused; drop them (or enable E402 if you truly need suppression).

🧹 Suggested cleanup
-from adit_radis_shared.telemetry import setup_opentelemetry  # noqa: E402
+from adit_radis_shared.telemetry import setup_opentelemetry
@@
-from django.core.asgi import get_asgi_application  # noqa: E402
+from django.core.asgi import get_asgi_application
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from adit_radis_shared.telemetry import setup_opentelemetry # noqa: E402
setup_opentelemetry()
from django.core.asgi import get_asgi_application # noqa: E402
from adit_radis_shared.telemetry import setup_opentelemetry
setup_opentelemetry()
from django.core.asgi import get_asgi_application
🧰 Tools
🪛 Ruff (0.14.14)

[warning] 18-18: Unused noqa directive (non-enabled: E402)

Remove unused noqa directive

(RUF100)


[warning] 22-22: Unused noqa directive (non-enabled: E402)

Remove unused noqa directive

(RUF100)

🤖 Prompt for AI Agents
In `@radis/asgi.py` around lines 18 - 22, Remove the unused inline flake8
suppression comments by deleting the trailing "# noqa: E402" on the import of
setup_opentelemetry and the import of get_asgi_application in radis/asgi.py;
keep the calls/imports (setup_opentelemetry() and get_asgi_application)
unchanged, and only remove the E402 suppressions (or enable E402 in config if
you truly need to suppress it).


django_asgi_app = get_asgi_application()

from channels.routing import ProtocolTypeRouter # noqa: E402
Expand Down
4 changes: 4 additions & 0 deletions radis/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from pathlib import Path

from adit_radis_shared.telemetry import add_otel_logging_handler, is_telemetry_active
from environs import env

# During development and calling `manage.py` from the host we have to load the .env file manually.
Expand Down Expand Up @@ -266,6 +267,9 @@
"root": {"handlers": ["console"], "level": "ERROR"},
}

if is_telemetry_active():
add_otel_logging_handler(LOGGING)

# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

Expand Down
272 changes: 270 additions & 2 deletions uv.lock

Large diffs are not rendered by default.