-
Notifications
You must be signed in to change notification settings - Fork 4
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Generate event specific reports #32
Conversation
I get an error during report generation when I run
|
I can confirm this bug for Python 3.10. For Python 3.11 it works. Need to check. |
I fixed that problem, I need to instantiate a Path to be consumed by Path.open |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers, yeh I guess ideally it would be nice to have some tests 😅
But as there were already no tests for this package, I won't block on it
This PR makes it possible to aggregate the runtime of event listeners for all fired Sphinx events.
Tricky part in pyinstrument is that all event listeners appear under
EventManager.emit
, so the event name is lost.The PR monkeypatches Sphinx to use a custom Event listener which injects an event specific
emit
function, so it can be tracked in pyinstrument.The PR can be tested with
sphinx-analysis --project needs --pyinstrument --tree
.A new JSON report of name
pyinstrument_sphinx_events.json
is created.It contains all unique combinations of file path, class and function of all event listeners, so it will pick up all extensions that have listeners registered.
The dictionary
sphinx_performance/sphinx_events.py:CUSTOM_FRAMES_BY_EVENT
can be modified to add more frames of interest (unrelated to events). It is currently used to track the runtime ofsphinxcontrib-plantuml
.The generated JSON file can be used for 2 purposes:
The HTML report now contains event specific function names, so event names can be searched.