Skip to content

Simplify lifecycle and telemetry ownership for 2.0 - #444

Merged
lesnik512 merged 4 commits into
mainfrom
simplify/2.0
Nov 6, 2026
Merged

lesnik512 merged 4 commits into
mainfrom
simplify/2.0

Conversation

@lesnik512

@lesnik512 lesnik512 commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

FastStream now keeps observability active through broker shutdown and user lifespan cleanup. FastStream, FastAPI, and FastMCP share the same policy for preserving a lifecycle error when teardown also fails.

OpenTelemetry rolls back resources acquired during a failed bootstrap, including failures during framework setup. Teardown preserves externally installed instrumentation and logging filters. Sentry clears its global client even when SENTRY_DSN is set.

This also removes the unused OTel exclusion helper, makes Pyroscope's additional parameters override the prepared defaults, and reports route configuration conflicts with the field to use.

Breaking changes

Code that drives FastStream through start() / stop() or async with application must call bootstrapper.teardown() in an outer finally block. The framework lifespan handles cleanup automatically. The 2.x migration guide documents both paths.

Verification

  • 672 tests passed with 100% coverage
  • Regression checks cover HTTP requests after Sentry teardown and temporary infrastructure exclusions for externally instrumented FastAPI apps
  • Type checks passed with ty 0.0.95 and 0.0.98
  • Ruff, ty, EOF checks, and strict docs build passed
  • Targeted checks passed on FastStream 0.6.0, Sentry 2.70.0, and FastMCP 4.0.0
  • Standards and spec reviews found no remaining issues

Closes #434
Closes #435
Closes #436
Closes #438
Closes #440

Includes the lifecycle work from #443 with the revised manual cleanup contract.

@lesnik512
lesnik512 merged commit 4d2bd1e into main Nov 6, 2026
35 checks passed
@lesnik512
lesnik512 deleted the simplify/2.0 branch November 6, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant