feat: migrate to mitol-django-observability plugin#3346
Conversation
Replace bespoke OpenTelemetry + logging boilerplate with the new mitol-django-observability shared plugin. Changes: - Remove main/telemetry.py (configure_opentelemetry moved to plugin) - Remove LOGGING dict from settings.py (provided by plugin) - Add 'from mitol.observability.settings.logging import LOGGING' - Add 'mitol.observability.apps.ObservabilityConfig' to INSTALLED_APPS - Update pyproject.toml: add mitol-django-observability dep, remove direct opentelemetry-api/sdk/exporter deps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
OpenAPI ChangesShow/hide ## Changes for v0.yaml:Unexpected changes? Ensure your branch is up-to-date with |
dsubak
left a comment
There was a problem hiding this comment.
Conceptually, this seems pretty straightforward. It'll change some logging behavior, but that's largely intentional afaict.
I'm going to hold off on formal approval until mitodl/ol-django#407 lands and I can actually start local with this branch. Since the package doesn't exist yet it just chokes on startup, which is totally expected but I do want to put it through the lightest testing ever before I put a stamp on it!
| "opentelemetry-api>=1.31.0", | ||
| "opentelemetry-exporter-otlp>=1.31.0", | ||
| "mitol-django-observability>=2026.1.0", | ||
| "opentelemetry-instrumentation-celery>=0.52b0", |
There was a problem hiding this comment.
One like... super minor concern I've got w/ the reliance on automatic instrumentation is that we no longer get big obvious failures if we screw something up (like if I were to inadvertently remove any of these otel-instrumentation-* packages).
I wonder if there's any value in adding an "expected" set of automatic instrumentations over in the plugin that is be defined by settings and throwing an error if we ever fail that?
It feels like it's probably overkill at the moment to me, but if we ended up seeing people accidentally dropping instrumentation that they don't consult every day, it might be a relatively quick and cheap way to let folks avoid surprise viz gaps.
There was a problem hiding this comment.
@dsubak can you give more color to your concerns? Are you referring to the overall automated instrumentation that happens with the OTEL SDK, or are you referring to e.g. the Celery and Postgres instrumentation based on the discovery of dependencies?
There was a problem hiding this comment.
@blarghmatey The latter - previously, if I were to remove opentelemetry-instrumentation-celery things would explode loudly in main/telemetry.py because we have to import and explicitly configure those extensions.
Now I believe that auto_instrument will simply instrument whatever is installed (respecting the skip and allowlists), meaning removing one of those packages from this repo silently removes the instrumentation.
Like I said, I do think it's kind of a minor concern - the main edge case this would be getting ahead of is something like a well-meaning cleanup PR where since they can't find usages in the repo they assume it's good to be removed - but figured I'd bring it up for discussion in case folks felt it was more important than I do.
There was a problem hiding this comment.
@dsubak Always appreciative of/open to bar raising but I think this one's ready to merge given that you're saying this seems a minor concern. lmk if you have objections, and we can always revert.
|
@blarghmatey I think this is waiting on you now, so I assigned it back to you and added the "waiting on author" label |
|
@copilot Please run 'uv lock' to update the uv lock file and commit/push that change to fix the failing tests. |
Agent-Logs-Url: https://github.com/mitodl/mitxonline/sessions/b0a75d31-eb5e-4053-8663-57ac529ae90d Co-authored-by: feoh <330070+feoh@users.noreply.github.com>
Done — ran Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot pre-commit says there is a marge conflict. Please resolve that conflict if the correct resolution is clear and straight forward. Otherwise let me know and don't touch anything. |
…lock Co-authored-by: feoh <330070+feoh@users.noreply.github.com>
Resolved in 94943d1 — merged Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Please review the two issues Sentry reported and fix them if they are actual problems. |
…lity migration Agent-Logs-Url: https://github.com/mitodl/mitxonline/sessions/84b60e04-efa9-487b-96ff-1a8184e68bfb Co-authored-by: feoh <330070+feoh@users.noreply.github.com>
Both issues are real and have been fixed in 2f45f1a:
|
uv lockto update the uv lock fileMITX_ONLINE_LOG_LEVEL→LOG_LEVELenv var so the observability plugin can consume it (backward compatibility)AdminEmailHandlerfordjango.requestto preserve 500-error email notifications to admins in production🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.