-
Notifications
You must be signed in to change notification settings - Fork 3
INTPYTHON-423 MQL panel for Django Debug Toolbar #29
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
a88b308
Implement MQL panel for Django Debug Toolbar
aclark4life 8328eda
Address review feedback
aclark4life a7c9ec7
Delete .coverage
timgraham 4bade48
Address review feedback (🤖 assisted)
aclark4life 86b57e1
Add tests based on sql panel tests (🤖 assisted)
aclark4life 8423a65
Jib review fixes
aclark4life 8885aa4
readme edits
aclark4life 22ba13d
Update gitignore
aclark4life 352bf3b
Address review feedback
aclark4life 4de35fe
Remove find
aclark4life 8186c5a
Fix convert_documents_to_table and add test
aclark4life a60193e
Address review feedback
aclark4life fc8cc25
Address review feedback
aclark4life b44209c
Add template_info support to MQL panel
aclark4life 246f537
Address review feedback
aclark4life 1f27725
Move template_info above stacktrace
aclark4life 4777e75
More verbose test run output
aclark4life b58f94c
Add test coverage harness
aclark4life 7c8508e
Rename select -> aggregate
aclark4life 0a8e660
Fix package version resolution for coverage
aclark4life a6c71fd
Move utils tests from test_panel -> test_utils
aclark4life 63bbdcd
Move forms tests from test_utils -> tests_forms
aclark4life 48c9058
Add QueryPartsTests
aclark4life 043fdf1
Rename mql select -> mql query
aclark4life f6b9dba
Address review feedback
aclark4life 5b6a8e5
Move MQL panel tests to tests/debug_toolbar/
aclark4life fa11ab2
Rename debug_toolbar.panels.mql/* -> mql_panel/*
aclark4life 5c3e9b7
Update readme
aclark4life 048534f
Refactor mql form clean() method
aclark4life 783a966
Address review feedback
aclark4life 5b758c1
Format mql_query and fix dhtml pre-commit hook
aclark4life 7bc42a9
Alpha-sort class methods
aclark4life 40eef2d
Address review feedback
aclark4life 0234ecb
Refactor tests
aclark4life 66d97ac
Bump zizmorcore/zizmor-action from 0.5.0 to 0.5.2 in the actions grou…
dependabot[bot] 2a685fb
Address review feedback
aclark4life File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| __pycache__ | ||
| uv.lock | ||
| .coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,79 @@ | ||
| # django-mongodb-extensions | ||
|
|
||
| Extensions for Django MongoDB Backend | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install django-mongodb-extensions | ||
| ``` | ||
|
|
||
| ## Extensions | ||
|
|
||
| ### MQL Panel | ||
|
|
||
| This panel for | ||
| [Django Debug Toolbar](https://github.com/jazzband/django-debug-toolbar) | ||
| provides insights into MongoDB queries executed during a request | ||
| similar to how the SQL panel works for relational databases. | ||
|
|
||
| **Features:** | ||
|
|
||
| - View all MongoDB queries (MQL) executed during a request | ||
| - See query execution time and identify slow queries | ||
| - Re-execute read operations (aggregate) directly from the toolbar | ||
| - Explain query execution plans | ||
| - Color-coded query grouping for easy identification | ||
| - Detailed query statistics and performance metrics | ||
|
|
||
| #### Configure the MQL Panel | ||
|
|
||
| First, install and configure Django Debug Toolbar by following their | ||
| [installation instructions](https://django-debug-toolbar.readthedocs.io/en/latest/installation.html). | ||
|
|
||
| 1. **Add to `INSTALLED_APPS`** in your Django settings: | ||
|
|
||
| ```python | ||
| INSTALLED_APPS = [ | ||
| # ... | ||
| "django_mongodb_extensions", | ||
| # ... | ||
| ] | ||
| ``` | ||
|
|
||
| 2. **Add the MQL Panel** to your debug toolbar configuration: | ||
|
|
||
| ```python | ||
| DEBUG_TOOLBAR_PANELS = [ | ||
| "debug_toolbar.panels.history.HistoryPanel", | ||
| "debug_toolbar.panels.versions.VersionsPanel", | ||
| "debug_toolbar.panels.timer.TimerPanel", | ||
| "debug_toolbar.panels.settings.SettingsPanel", | ||
| "debug_toolbar.panels.headers.HeadersPanel", | ||
| "debug_toolbar.panels.request.RequestPanel", | ||
| # Add this: | ||
| "django_mongodb_extensions.mql_panel.MQLPanel", | ||
| "debug_toolbar.panels.templates.TemplatesPanel", | ||
| "debug_toolbar.panels.staticfiles.StaticFilesPanel", | ||
| "debug_toolbar.panels.cache.CachePanel", | ||
| "debug_toolbar.panels.signals.SignalsPanel", | ||
| "debug_toolbar.panels.redirects.RedirectsPanel", | ||
| "debug_toolbar.panels.profiling.ProfilingPanel", | ||
| ] | ||
| ``` | ||
|
|
||
| 3. **Optional:** Configure settings. | ||
|
|
||
| ```python | ||
| # Maximum number of documents to return when re-executing select | ||
| # queries (default is 100). | ||
| DJDT_MQL_MAX_QUERY_RESULTS = 25 | ||
|
|
||
| # Queries slower than this threshold (in milliseconds) are highlighted | ||
| # in the debug toolbar (default is 500 ms). | ||
| DJDT_MQL_WARNING_THRESHOLD = 1000 | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| See [LICENSE](LICENSE) file for details. |
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
django_mongodb_extensions/debug_toolbar/panels/mql/__init__.py
This file was deleted.
Oops, something went wrong.
63 changes: 0 additions & 63 deletions
63
django_mongodb_extensions/debug_toolbar/panels/mql/panel.py
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
django_mongodb_extensions/debug_toolbar/panels/mql/tracking.py
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from django_mongodb_extensions.mql_panel.panel import MQLPanel | ||
|
|
||
| __all__ = [MQLPanel.panel_id] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.