Skip to content

feat: Django-free structlog to OTel integration via otel extra#229

Merged
khvn26 merged 3 commits into
mainfrom
feat/otel-extra
Jun 4, 2026
Merged

feat: Django-free structlog to OTel integration via otel extra#229
khvn26 merged 3 commits into
mainfrom
feat/otel-extra

Conversation

@khvn26

@khvn26 khvn26 commented Jun 4, 2026

Copy link
Copy Markdown
Member

Changes

New otel extra so non-Django services can use the structlog → OTel processor chain.

The Django/psycopg2/Redis instrumentors are imported lazily in setup_tracing(), making common.core.otel importable without Django.

How did you test this code?

Existing tests, plus built the wheel and verified flagsmith-common[otel] imports common.core.{logging,otel} in an isolated venv without Django.

@khvn26 khvn26 requested a review from a team as a code owner June 4, 2026 09:37
@khvn26 khvn26 requested review from emyller and removed request for a team June 4, 2026 09:37
@codecov-commenter

codecov-commenter commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.39%. Comparing base (276b8c5) to head (999c785).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #229   +/-   ##
=======================================
  Coverage   97.38%   97.39%           
=======================================
  Files         105      105           
  Lines        4595     4600    +5     
=======================================
+ Hits         4475     4480    +5     
  Misses        120      120           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/common/core/otel.py Outdated
@khvn26 khvn26 force-pushed the feat/otel-extra branch from 6fb377a to 7285c0c Compare June 4, 2026 09:58
khvn26 added 2 commits June 4, 2026 11:01
Add an `otel` extra carrying the dependencies of common.core.logging
and common.core.otel, and import the Django, psycopg2 and Redis
instrumentors lazily in setup_tracing — the only place they are used —
so both modules import without Django installed. Enables non-Django
services (first up: the MCP server) to reuse the structlog -> OTel
processor chain.

beep boop
@khvn26 khvn26 force-pushed the feat/otel-extra branch from 7285c0c to f9caea5 Compare June 4, 2026 10:01
Comment thread tests/unit/common/core/test_otel.py Outdated
Remove unnecessary docstring from test function.
@khvn26 khvn26 merged commit 01b8ed7 into main Jun 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants