From df78470e2040104b878d83e7e0723329e923bc8a Mon Sep 17 00:00:00 2001 From: Ritwik Date: Tue, 12 May 2026 12:02:27 +0200 Subject: [PATCH 1/2] Pass Django and Psycopg instrumentors explicitly to setup_opentelemetry setup_opentelemetry() in adit-radis-shared 0.24.0 no longer instruments Django and Psycopg unconditionally; instead the caller passes the instrumentor classes. ADIT and RADIS both pass the same list to keep their telemetry behaviour identical to today. - manage.py and adit/asgi.py: import DjangoInstrumentor and PsycopgInstrumentor and pass them as instrumentors=[...]. - pyproject.toml: request the [django] extra of adit-radis-shared so the instrumentor packages are installed alongside the core SDK. Bump the pin to 0.24.0 (release-to-be cut from the openobserve branch line after the corresponding shared-repo PR merges). Re-generate uv.lock with `uv lock --upgrade-package adit-radis-shared` once the 0.24.0 tag exists on origin. Co-Authored-By: Claude Opus 4.7 (1M context) --- adit/asgi.py | 4 +++- manage.py | 4 +++- pyproject.toml | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/adit/asgi.py b/adit/asgi.py index 0b5546ea..f7fffb24 100644 --- a/adit/asgi.py +++ b/adit/asgi.py @@ -16,8 +16,10 @@ # Initialize OpenTelemetry before Django loads to ensure all requests are traced from adit_radis_shared.telemetry import setup_opentelemetry # noqa: E402 +from opentelemetry.instrumentation.django import DjangoInstrumentor # noqa: E402 +from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor # noqa: E402 -setup_opentelemetry() +setup_opentelemetry(instrumentors=[DjangoInstrumentor, PsycopgInstrumentor]) from channels.security.websocket import AllowedHostsOriginValidator # noqa: E402 from channels.sessions import SessionMiddlewareStack # noqa: E402 diff --git a/manage.py b/manage.py index c2ffb19e..440c8d33 100755 --- a/manage.py +++ b/manage.py @@ -25,8 +25,10 @@ def main(): # Initialize OpenTelemetry before Django loads to ensure all requests are traced from adit_radis_shared.telemetry import setup_opentelemetry + from opentelemetry.instrumentation.django import DjangoInstrumentor + from opentelemetry.instrumentation.psycopg import PsycopgInstrumentor - setup_opentelemetry() + setup_opentelemetry(instrumentors=[DjangoInstrumentor, PsycopgInstrumentor]) initialize_debugger() diff --git a/pyproject.toml b/pyproject.toml index 68e444ac..f85779f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,12 @@ 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.23.0", + # The [django] extra carries opentelemetry-instrumentation-django and + # -psycopg, which are imported in manage.py / adit/asgi.py and passed to + # setup_opentelemetry(instrumentors=[...]). Non-Django consumers of + # adit-radis-shared install the bare package and pass their own + # instrumentor list (or none). + "adit-radis-shared[django] @ git+https://github.com/openradx/adit-radis-shared.git@0.24.0", "adrf>=0.1.9", "aiofiles>=24.1.0", "asyncinotify>=4.2.0", From 6a67f1c91850d142efaaf8d2899fd229bc9935b2 Mon Sep 17 00:00:00 2001 From: Ritwik Date: Tue, 12 May 2026 13:04:58 +0200 Subject: [PATCH 2/2] Bump adit-radis-shared lock to 0.24.0 Now that openradx/adit-radis-shared#195 has merged and the 0.24.0 tag is cut, re-resolve the lock against the tag the pyproject pin already references. Co-Authored-By: Claude Opus 4.7 (1M context) --- uv.lock | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/uv.lock b/uv.lock index dcd3e284..cb0ce2d2 100644 --- a/uv.lock +++ b/uv.lock @@ -10,7 +10,7 @@ name = "adit" version = "0.0.0" source = { editable = "." } dependencies = [ - { name = "adit-radis-shared" }, + { name = "adit-radis-shared", extra = ["django"] }, { name = "adrf" }, { name = "aiofiles" }, { name = "asyncinotify" }, @@ -104,7 +104,7 @@ docs = [ [package.metadata] requires-dist = [ - { name = "adit-radis-shared", git = "https://github.com/openradx/adit-radis-shared.git?rev=0.23.0" }, + { name = "adit-radis-shared", extras = ["django"], git = "https://github.com/openradx/adit-radis-shared.git?rev=0.24.0" }, { name = "adrf", specifier = ">=0.1.9" }, { name = "aiofiles", specifier = ">=24.1.0" }, { name = "asyncinotify", specifier = ">=4.2.0" }, @@ -213,7 +213,7 @@ requires-dist = [ [[package]] name = "adit-radis-shared" version = "0.0.0" -source = { git = "https://github.com/openradx/adit-radis-shared.git?rev=0.23.0#2ea948f4492496de1c65f4aad04a603c1175d83a" } +source = { git = "https://github.com/openradx/adit-radis-shared.git?rev=0.24.0#39955cf5dbb2fd8ab421a5bfb404d518b39d14ec" } dependencies = [ { name = "channels" }, { name = "crispy-bootstrap5" }, @@ -236,8 +236,6 @@ dependencies = [ { name = "environs", extra = ["django"] }, { name = "opentelemetry-api" }, { name = "opentelemetry-exporter-otlp-proto-http" }, - { name = "opentelemetry-instrumentation-django" }, - { name = "opentelemetry-instrumentation-psycopg" }, { name = "opentelemetry-sdk" }, { name = "procrastinate", extra = ["django"] }, { name = "psycopg", extra = ["binary"] }, @@ -249,6 +247,12 @@ dependencies = [ { name = "whitenoise" }, ] +[package.optional-dependencies] +django = [ + { name = "opentelemetry-instrumentation-django" }, + { name = "opentelemetry-instrumentation-psycopg" }, +] + [[package]] name = "adrf" version = "0.1.12"