Skip to content

Commit 1ca0962

Browse files
authored
Merge pull request #355 from Lujeni/docs/guide_fastapi
docs(guide): complete FastAPI example
2 parents bb015ba + 862b9ad commit 1ca0962

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/guide.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ app is the name of your FastAPI application instance.
229229
Make sure you configure a setting to only make this available when required.
230230

231231
```python
232+
from fastapi import Request
233+
from fastapi.responses import HTMLResponse
232234
from pyinstrument import Profiler
233235

234236

@@ -239,7 +241,7 @@ if PROFILING:
239241
async def profile_request(request: Request, call_next):
240242
profiling = request.query_params.get("profile", False)
241243
if profiling:
242-
profiler = Profiler(interval=settings.profiling_interval, async_mode="enabled")
244+
profiler = Profiler()
243245
profiler.start()
244246
await call_next(request)
245247
profiler.stop()
@@ -345,7 +347,6 @@ app = Litestar(
345347

346348
To invoke, make any request to your application and it will return the HTML result from pyinstrument instead of your application's response.
347349

348-
349350
## Profile Pytest tests
350351

351352
Pyinstrument can be invoked via the command-line to run pytest, giving you a

0 commit comments

Comments
 (0)