File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,8 @@ app is the name of your FastAPI application instance.
229
229
Make sure you configure a setting to only make this available when required.
230
230
231
231
``` python
232
+ from fastapi import Request
233
+ from fastapi.responses import HTMLResponse
232
234
from pyinstrument import Profiler
233
235
234
236
@@ -239,7 +241,7 @@ if PROFILING:
239
241
async def profile_request (request : Request, call_next ):
240
242
profiling = request.query_params.get(" profile" , False )
241
243
if profiling:
242
- profiler = Profiler(interval = settings.profiling_interval, async_mode = " enabled " )
244
+ profiler = Profiler()
243
245
profiler.start()
244
246
await call_next(request)
245
247
profiler.stop()
@@ -345,7 +347,6 @@ app = Litestar(
345
347
346
348
To invoke, make any request to your application and it will return the HTML result from pyinstrument instead of your application's response.
347
349
348
-
349
350
## Profile Pytest tests
350
351
351
352
Pyinstrument can be invoked via the command-line to run pytest, giving you a
You can’t perform that action at this time.
0 commit comments