Quickstart¶
FastAPI¶
Open /profiler. Every request your application has handled is there.
Starlette¶
Identical — install() takes any Starlette application:
from starlette.applications import Starlette
from asgi_profiler import install
app = Starlette(routes=[...])
install(app)
SQLModel¶
Nothing extra to do. sqlmodel.create_engine returns a SQLAlchemy Engine
and sqlmodel.Session subclasses sqlalchemy.orm.Session, so the same cursor
events fire. Async engines work unchanged too.
Call it before the app serves¶
install() adds middleware, and ASGI middleware cannot be added once the
application has started. Call it at import time, next to where you build the
app — not inside a startup handler.
Keeping history across restarts¶
The default store is in-memory and per-process, so it empties on restart and
each uvicorn worker holds its own. For anything longer-lived:
See Storage.
Reading it outside the app¶
A capture written to SQLite can be browsed without booting the application that produced it:
See the CLI reference.