Skip to content

[Bug]: Cannot send trace with FastAPI #804

@minatooni

Description

@minatooni

Problem Description

With FastAPI app, traces will not be sent

Root cause: The I/F of FastAPI middleware are not covered perfectly and failed to insert instana asgi middleware. For example, the following configuration avoid asgi middleware insert because tuple is not covered. (Tuple is valid as arg because FastAPI accepts Sequence as middleware)

app = FastAPI(
    title="Title",
    summary="Summary",
    middleware=(),
)

I'll make a pr to fix this

Minimal, Complete, Verifiable, Example

app = FastAPI(
    title="Title",
    summary="Summary",
    middleware=(),
)

Python Version

Python 3.12

Python Modules

[tool.poetry.dependencies]
python = ">=3.12,<3.13"
pydantic = "^2.11.7"
fastapi = { extras = ["standard"], version = "^0.115.13" }
uvicorn = { extras = ["standard"], version = "^0.34.3" }
python-jose = { extras = ["cryptography"], version = "^3.5.0" }
bcrypt = "4.0.1"
uuid-utils = "^0.11.0"
passlib = "^1.7.4"
gunicorn = "^23.0.0"
pydantic-settings = "^2.9.1"
httpx = "^0.28.1"
sqlmodel = "^0.0.24"
psycopg2 = "^2.9.10"
asyncpg = "^0.30.0"
faker = "^37.5.3"
instana = "^3.7.1"

Python Environment

Let me skip cuz it does not matter to this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions