FastAPI 0.143.0 introduces a breaking change to how the framework handles OpenTelemetry, shifting automatic exporter setup from a default behaviour to something developers must explicitly enable.
The change, contributed by @tiangolo via PR #16476, affects applications that previously relied on FastAPI to read OTEL_* environment variables and configure tracing exporters on their behalf.
- Automatic OpenTelemetry exporter setup is now opt-in and no longer enabled by default.
- To retain the previous behaviour, set the environment variable
FASTAPI_OTEL_AUTO_CONFIGURE=truebefore starting your app. - Alternatively, pass the configuration directly in code with
FastAPI(telemetry={"auto_configure": True}). - Applications that already build and register their own OpenTelemetry providers and exporters require no changes.
- FastAPI Cloud continues to enable automatic setup for you, so deployments there are unaffected.
For developers, the practical impact depends entirely on how tracing is wired up today. If your service depends on FastAPI to wire exporters from OTEL_* variables, upgrading without setting the opt-in flag or the telemetry argument will silently stop exporter configuration, which can leave you without traces and complicate incident debugging.
Teams that manage their own TracerProvider, span processors and exporters keep the same behaviour and can upgrade without touching configuration. The broader direction is a reduction in implicit magic: framework-level side effects driven by ambient environment variables are being replaced with explicit choices, which makes precedence easier to reason about and avoids surprising network activity in environments where those variables happen to be set.
Before upgrading, audit whether any environment variables such as OTEL_EXPORTER_OTLP_ENDPOINT are currently being consumed implicitly by FastAPI. If so, adopt one of the two opt-in mechanisms as part of the upgrade, and confirm spans still reach your collector or backend.
Source: https://github.com/fastapi/fastapi/releases/tag/0.143.0