Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profiling python web frameworks #428

Closed
raqibhayder opened this issue Sep 30, 2021 · 7 comments 路 Fixed by #440
Closed

Profiling python web frameworks #428

raqibhayder opened this issue Sep 30, 2021 · 7 comments 路 Fixed by #440
Assignees
Labels
bug Something isn't working integrations 馃悕. python Related to Python

Comments

@raqibhayder
Copy link

raqibhayder commented Sep 30, 2021

Amazing work with Pyroscope. 馃憦馃徑

Is there a way to profile web frameworks like FastAPI, Starlette or Flask?

We are currently using new relic and were testing out Pyroscope as an alternative for performance monitoring. We are using gunicorn with UvicornWorkers and FastAPI as our framework using the following docker image.

We are able to see all gunicorn, uvicorn and our application function calls but unable to see anything related to Starlette (the framework FastAPI is wrapped around), specifically Starlette middleware calls.

I feel like I am missing something silly here, any help would be appreciated.

Thank you 馃槃

@petethepig
Copy link
Member

Hi @raqib-hayder

Thanks for the kind words :)

Pyroscope should work great with the use-case you're describing and should generally work with any framework like gunicorn.

This might be related to the way subprocesses / forks are treated by the pyroscope agent. I can try to reproduce the issue with the docker image you linked and see if there's a bug somewhere.

The only question I have right now is how are you integrating with pyroscope? Are you running it via pyroscope exec or the pip package (pyroscope-io)?

@petethepig petethepig added bug Something isn't working 馃悕. python Related to Python labels Oct 1, 2021
@petethepig petethepig self-assigned this Oct 1, 2021
@raqibhayder
Copy link
Author

@petethepig : We are using the pip package pyroscope-io.

@raqibhayder
Copy link
Author

@Rperry2174 and @petethepig : Thank you for updating the example. Will give this a try and let you guys know how it went. Much apprecaited.

@Rperry2174
Copy link
Contributor

@raqib-hayder I created an example with fastapi and was able to reproduce not being able to see the stacktraces for the starlette middleware. We're still looking into why these don't show up in this particular case

@raqibhayder
Copy link
Author

You guys are awesome! Thank you for promptly looking into this.

petethepig added a commit that referenced this issue Oct 7, 2021
@petethepig petethepig reopened this Oct 7, 2021
@petethepig
Copy link
Member

petethepig commented Oct 7, 2021

Hi @raqib-hayder

We just released a new version of the pip package (0.4.0) with a fix for this issue.

Let me know if it works for you.

@raqibhayder
Copy link
Author

Hey @petethepig: It does. Thank you!

Screen Shot 2021-10-07 at 8 46 01 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integrations 馃悕. python Related to Python
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants