Skip to content

Make opentracing an optional dependency (faust[opentracing])#686

Merged
wbarnha merged 4 commits into
masterfrom
claude/opentracing-optional
Jul 21, 2026
Merged

Make opentracing an optional dependency (faust[opentracing])#686
wbarnha merged 4 commits into
masterfrom
claude/opentracing-optional

Conversation

@wbarnha

@wbarnha wbarnha commented Jul 17, 2026

Copy link
Copy Markdown
Member

Description

opentracing is archived/EOL (folded into OpenTelemetry) and was pinned <=2.4.0, yet it was a required core dependency — pulled by every Faust install even though distributed tracing is opt-in (app.tracer defaults to None). This moves it to an optional extra, so the default install no longer depends on an unmaintained package.

This is Option A from a broader OpenTracing-removal discussion: the smallest, non-breaking step. No public API changesTracerT, app.tracer, app.trace(), faust.sensors.distributed_tracing.TracingSensor, and faust.utils.tracing all keep working. Real tracing just now requires pip install faust[opentracing].

How it works

  • New tiny no-op stand-in faust/utils/_opentracing.py (a Span/Tracer + tags/Format/follows_from/start_child_span surface, all no-ops).
  • The six tracing-touching modules do a guarded import that falls back to it:
    try:
        import opentracing
    except ImportError:  # pragma: no cover
        from faust.utils import _opentracing as opentracing
    So Faust imports and runs without opentracing installed — tracing simply becomes a no-op. The only runtime path reached without a tracer is noop_span() (returns a stub span); every other opentracing reference is a type annotation or gated behind if tracer is not None.

Packaging

  • Drop opentracing>=1.3.0,<=2.4.0 from requirements/requirements.txt.
  • Add requirements/extras/opentracing.txt + the opentracing bundle in setup.pyfaust[opentracing].
  • Keep it in requirements/test.txt so CI still exercises the real opentracing path (the aiokafka tests use opentracing.Span directly).

Verification

  • Without opentracing installed: import faust, create a default kafka:// App, resolve the transport registry, noop_span(), and import/instantiate TracingSensor — all work (verified by uninstalling the package).
  • With opentracing installed: tests/unit/tables/test_recovery.py, test_base.py, test_aiokafka.py277 passed, 23 skipped.
  • Lint clean (isort / black / flake8) across all changed files.

Migration note

Users who configure app.tracer or add TracingSensor should install faust[opentracing]. Worth a CHANGELOG entry; a natural follow-up (next major) is to remove the built-in tracing entirely in favor of the community opentelemetry-instrumentation-faust.


Generated by Claude Code

opentracing is archived/EOL and was a required core dependency even
though distributed tracing is opt-in (app.tracer defaults to None). Move
it to an optional extra so the default install no longer pulls it.

Add a tiny no-op stand-in (faust/utils/_opentracing.py) that the six
tracing-touching modules fall back to when opentracing is not installed,
so Faust still imports and runs -- tracing simply becomes a no-op. The
only runtime path hit without a tracer is noop_span(), which now returns
a stub span; every other opentracing use is either a type annotation or
gated behind 'if tracer is not None'. Real tracing (app.tracer /
TracingSensor) still requires installing faust[opentracing].

- requirements: drop opentracing from requirements.txt; add
  requirements/extras/opentracing.txt and the 'opentracing' setup.py
  bundle; keep it in test.txt so CI still exercises the real path.
- No public API change: TracerT, app.tracer, app.trace(), TracingSensor
  and faust.utils.tracing all keep working.
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.97%. Comparing base (50e35ad) to head (469a3cc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #686      +/-   ##
==========================================
- Coverage   96.00%   95.97%   -0.04%     
==========================================
  Files         104      103       -1     
  Lines       11169    11069     -100     
  Branches     1206     1191      -15     
==========================================
- Hits        10723    10623     -100     
  Misses        352      352              
  Partials       94       94              

☔ 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.

wbarnha added 2 commits July 17, 2026 13:18
faust/utils/_opentracing.py is only imported when opentracing is not
installed; the CI test env always installs faust[opentracing], so the
stub is never exercised and shows 0% coverage. Omit it like the sibling
faust/utils/tracing.py already is.
faust/sensors/distributed_tracing.py (TracingSensor) is optional tracing
code -- it requires opentracing plus a live tracer to exercise and has no
tests, so it was already effectively uncovered; the guarded-import change
just surfaced it in the patch diff. Omit it like the sibling tracing
modules (faust/utils/tracing.py, faust/utils/_opentracing.py) already are.
wbarnha added a commit that referenced this pull request Jul 19, 2026
Per review, the v0.12.0 changelog/release notes should describe only what is
already on master, not work still in open PRs.

- Remove the not-yet-merged items: the offset-commit data-loss fixes
  (#606/#707, #316/#692), the optional OpenTracing/OpenTelemetry extras
  (#685/#686, #688/#681), web_application_options (#704), and the reported-issue
  fix stack (#693-#703, #705). These will be added back as they merge.
- Add a Dependencies section noting the current runtime/client libraries:
  mode-streaming >= 0.4.0, aiokafka >= 0.10.0 (compatible with recent 0.13/0.14
  releases), the new confluent-kafka >= 2.0.0 for faust[ckafka], and the
  faust-cchardet fork replacing unmaintained cchardet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHPL4VFWQRQPpjR1gXSKyL
@wbarnha
wbarnha enabled auto-merge July 21, 2026 17:49
wbarnha added a commit to SpencerWhitehead7/faust that referenced this pull request Jul 21, 2026
…st-streaming#708)

* docs: prepare v0.12.0 release notes and changelog

Resume the Keep a Changelog format (dormant since v0.8.10) with a v0.12.0
section, and add standalone GitHub release notes covering the changes since
v0.11.3 plus the pending fix stack.

Highlights: two offset data-loss fixes (faust-streaming#606/faust-streaming#707, faust-streaming#316/faust-streaming#692), the
re-added confluent-kafka driver, Python 3.14 support (3.8/3.9 dropped),
OpenTracing/OpenTelemetry made optional, and a live-broker CI harness.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHPL4VFWQRQPpjR1gXSKyL

* docs: drop closed codecov.yml PR (faust-streaming#683) from v0.12.0 notes

PR faust-streaming#683 (codecov.yml with a 1% coverage threshold) was closed without
merging, so remove it from the changelog and release notes to keep the
v0.12.0 change list accurate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHPL4VFWQRQPpjR1gXSKyL

* docs: derive Sphinx version from the package instead of a stale constant

`docs/conf.py` hardcoded `version_dev='1.1'` / `version_stable='1.0'` -
robinhood-era values that never matched faust-streaming's 0.x line, so the
published GitHub Pages docs advertised the wrong version.

Derive the documented major.minor from `faust.__version__` (which
setuptools_scm resolves from the git tag), so the docs always report the real
version and this can't silently drift between releases.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHPL4VFWQRQPpjR1gXSKyL

* docs: scope v0.12.0 notes to merged work; note dependency updates

Per review, the v0.12.0 changelog/release notes should describe only what is
already on master, not work still in open PRs.

- Remove the not-yet-merged items: the offset-commit data-loss fixes
  (faust-streaming#606/faust-streaming#707, faust-streaming#316/faust-streaming#692), the optional OpenTracing/OpenTelemetry extras
  (faust-streaming#685/faust-streaming#686, faust-streaming#688/faust-streaming#681), web_application_options (faust-streaming#704), and the reported-issue
  fix stack (faust-streaming#693-faust-streaming#703, faust-streaming#705). These will be added back as they merge.
- Add a Dependencies section noting the current runtime/client libraries:
  mode-streaming >= 0.4.0, aiokafka >= 0.10.0 (compatible with recent 0.13/0.14
  releases), the new confluent-kafka >= 2.0.0 for faust[ckafka], and the
  faust-cchardet fork replacing unmaintained cchardet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHPL4VFWQRQPpjR1gXSKyL

* docs: set v0.12.0 changelog date to 2026-07-19

Replace the UNRELEASED placeholder with the release date and drop the
now-satisfied "set the date at tag time" note.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHPL4VFWQRQPpjR1gXSKyL

* Delete RELEASE_NOTES_v0.12.0.md

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@wbarnha
wbarnha disabled auto-merge July 21, 2026 17:59
@wbarnha
wbarnha enabled auto-merge July 21, 2026 18:01
@wbarnha
wbarnha merged commit 987bc48 into master Jul 21, 2026
51 of 54 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.

1 participant