-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Download prof files #2286
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
base: main
Are you sure you want to change the base?
Download prof files #2286
Conversation
for more information, see https://pre-commit.ci
…-toolbar into download-prof-files
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||
for more information, see https://pre-commit.ci
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.
Pull request overview
This PR adds the ability to download profiling data as .prof files, addressing issue #1798. The feature is disabled by default and requires configuring the PROFILER_PROFILE_ROOT setting to specify where profile files should be saved.
Key changes:
- Added
PROFILER_PROFILE_ROOTconfiguration setting to control where profile files are saved - Implemented profile file generation in the profiling panel with signed filenames for security
- Created a new download view with URL endpoint to serve the profile files
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
debug_toolbar/settings.py |
Added PROFILER_PROFILE_ROOT default setting (None) |
debug_toolbar/panels/profiling.py |
Modified to generate and save .prof files when PROFILER_PROFILE_ROOT is configured; signs filename for secure download |
debug_toolbar/views.py |
Added download_prof_file view to handle file downloads with signature validation |
debug_toolbar/toolbar.py |
Registered new download URL endpoint |
debug_toolbar/urls.py |
Minor whitespace addition |
debug_toolbar/templates/debug_toolbar/panels/profiling.html |
Added download link UI and reformatted indentation |
debug_toolbar/static/debug_toolbar/css/toolbar.css |
Added styling for download control |
tests/panels/test_profiling.py |
Added comprehensive tests for profile file generation and download functionality |
docs/configuration.rst |
Documented the new PROFILER_PROFILE_ROOT setting |
docs/changes.rst |
Added changelog entry for the new feature |
debug_toolbar/panels/sql/tracking.py |
Unrelated changes to handle executemany parameters in SQL tracking |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hello everyone sorry for not finishing this. I have been a bit caught up working on other OSS projects . I promise to push new commits this weekend to fix the reviews co pilot left |
e690762 to
09f2ba0
Compare
tim-schilling
left a comment
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.
Thank you for continuing to work on this 🚀. I've got some questions about the direction of this. If you're confused, or think I may be wrong, please let me know. I'm happy to hop on a call and chat about this too!
|
|
||
| root_func = cProfile.label(super().process_request.__code__) | ||
| profile_root = dt_settings.get_config()["PROFILER_PROFILE_ROOT"] | ||
| storage = FileSystemStorage(location=profile_root) |
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.
Could we use django.core.files.storage.default_storage instead of instantiating a new one?
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.
Are we going in the wrong direction here trying to write actual files to the server? Couldn't we just store the file's content with the panel, then render that out like a file in download_prof_file?
Sorry to shift our direction again, but something isn't sitting right with me. What do you think? I'd love to know if you feel the same.
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.
I have a question i assume by storing the files content in the panel this would be ephemeral right? If we dont need persistence we could do that
Description
This pr is based on the work of @andoriyaprashant which he made to fix #1798. I am continuing his work to get it over the finish line. His pr is this #2146 .
Fixes #1798
Checklist:
docs/changes.rst.