Reputation: 11
I tried using yappi (version 1.4.0) to profile my python (3.10) server.
I am using FastAPI version 0.88.0 and uvicorn version 0.20.0 , And no matter how I try to run multithreaded-profiling I cannot get yappi to capture anything but the _MainThread thread :( .
All of my actual code runs and produces the logs and results I expect, but cannot find a single call to a function/module of my own code in the profiling results.
I have seen this lone thread (https://github.com/sumerc/yappi/issues/98) that does not relate to my problem, and looked over everything in the docs and saw nothing wrong with that I was doing.
I tried using yappi as a module like so:
import yappi
import fastapi
app = FastAPI()
app.include_router(...)
... # Send out a few requests, see logs of the requests being handled by my code
yappi.start() # 'profile_threads=True' default value
uvicorn.run("main:app")
yappi.stop()
yappi.get_func_stats().print_all()
yappi.get_threads_stats().print_all()
And get only results about the _MainThread.
I also tried using the CLI usage, so I ran the following command:
yappi server/main.py
and got the same result.
I KNOW my code runs, but there is not a single mention of it in the profile results :(
Upvotes: 1
Views: 1026