FastAPI 0.142.4 Fixes Telemetry Leakage for Excluded Requests

FastAPI · 7 Oct 2026 · 2 min read

#fastapi

FastAPI 0.142.4 has landed as a focused bug-fix release, addressing a subtle but important issue in how the framework wires up its OpenTelemetry instrumentation. The patch, delivered in PR #16470 by maintainer @tiangolo, isolates FastAPI's telemetry so that requests explicitly excluded from instrumentation no longer interfere with the spans and metrics generated for the requests you do want to observe. For teams running production APIs where noise-free traces are essential, this is a small change with meaningful operational impact.

Here is what the release contains:

  • Fix: Isolate FastAPI telemetry for excluded requests, so instrumentation state is no longer shared between excluded and non-excluded requests.
  • PR: #16470 by @tiangolo, merged into the 0.142.x line.
  • Version: Bump to 0.142.4, a patch release with no new public APIs.

The underlying problem is that FastAPI's instrumentation setup can leak context across request boundaries when certain routes are excluded from tracing. In practice, that could mean spans attributed to the wrong request, missing spans for routes you expect to trace, or unexpected telemetry on endpoints you deliberately opted out of. The fix tightens that boundary so each request's telemetry lifecycle stays self-contained, regardless of exclusion rules configured via the OpenTelemetry instrumentation settings.

Why it matters: observability is only as useful as it is accurate. If your team relies on OpenTelemetry traces to debug latency, monitor error rates, or feed dashboards in Grafana, Jaeger, or a hosted APM, inconsistent span data can send you chasing phantom regressions. Excluding health checks, /metrics scrapes, or noisy webhook endpoints is standard practice, and this release ensures that opting out of tracing for one route does not corrupt the signal for every other route. Upgrading is low-risk since it is a patch release: run pip install --upgrade fastapi and verify your existing instrumentation config still produces the spans you expect.

Source: https://github.com/fastapi/fastapi/releases/tag/0.142.4

Related

auto-curated · source linked above ← all news