Skip to content

Pin opentelemetry-instrumentation-fastapi and -httpx to >=0.64b0 (FastAPI >=0.137 _IncludedRouter crash) #18

Description

@anth-volk

Summary

pyproject.toml declares opentelemetry-instrumentation-fastapi and opentelemetry-instrumentation-httpx in the core dependencies without a version floor. FastAPI 0.137.0 (2026-06-14) introduced a routing change — include_router now yields a lazily-matching _IncludedRouter object with no .path — that makes opentelemetry-instrumentation-fastapi < 0.64b0 raise AttributeError: '_IncludedRouter' object has no attribute 'path' on CORS preflight OPTIONS requests to include_router-mounted routes → unhandled 500.

This took down a downstream consumer, policyengine-uk-chat, in production: every browser preflight 500'd and the app was unusable (PolicyEngine/policyengine-uk-chat#167). It affects any consumer that enables instrument_fastapi on FastAPI ≥0.137.

Upstream

Change

Pin the instrumentation floors to the fixed release in pyproject.toml (and refresh uv.lock):

  • opentelemetry-instrumentation-fastapi>=0.64b0
  • opentelemetry-instrumentation-httpx>=0.64b0 (same coordinated OTel release train — keep them aligned)

Possible follow-up (not in this change)

Per this repo's own guidance ("observability failures must fail open — do not break the observed operation"), the FastAPI adapter should arguably guard against an instrumentor raising per-request. The crash occurs inside OpenTelemetry's own ASGI middleware, so failing open there needs an adapter-level wrapper rather than the setup-time try/except we have around instrument_app() today. Worth a separate hardening task so a future instrumentor incompatibility degrades instead of 500-ing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions