From 6cb639645415b7e1288e9d5becb92c53e6f06b56 Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Tue, 20 Aug 2024 23:58:07 +0530 Subject: [PATCH 01/20] ASGI check approach with added test and docs --- debug_toolbar/toolbar.py | 15 +++++++++------ docs/architecture.rst | 2 +- tests/test_integration.py | 18 +++++++++++++++++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index 35d789a53..921546aaf 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -12,6 +12,7 @@ from django.apps import apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured +from django.core.handlers.asgi import ASGIRequest from django.dispatch import Signal from django.template import TemplateSyntaxError from django.template.loader import render_to_string @@ -101,12 +102,14 @@ def should_render_panels(self): If False, the panels will be loaded via Ajax. """ if (render_panels := self.config["RENDER_PANELS"]) is None: - # If wsgi.multiprocess isn't in the headers, then it's likely - # being served by ASGI. This type of set up is most likely - # incompatible with the toolbar until - # https://github.com/jazzband/django-debug-toolbar/issues/1430 - # is resolved. - render_panels = self.request.META.get("wsgi.multiprocess", True) + # If wsgi.multiprocess is true then it is either being served + # from ASGI or multithreaded third-party WSGI server eg gunicorn. + # we need to make special handling for ASGI for supporting + # async context based requests. + if isinstance(self.request, ASGIRequest): + render_panels = False + else: + render_panels = self.request.META.get("wsgi.multiprocess", True) return render_panels # Handle storing toolbars in memory and fetching them later on diff --git a/docs/architecture.rst b/docs/architecture.rst index 0043f5153..cf5c54951 100644 --- a/docs/architecture.rst +++ b/docs/architecture.rst @@ -82,7 +82,7 @@ Problematic Parts - Support for async and multi-threading: ``debug_toolbar.middleware.DebugToolbarMiddleware`` is now async compatible and can process async requests. However certain panels such as ``SQLPanel``, ``TimerPanel``, - ``RequestPanel``, ``HistoryPanel`` and ``ProfilingPanel`` aren't fully + ``RequestPanel`` and ``ProfilingPanel`` aren't fully compatible and currently being worked on. For now, these panels are disabled by default when running in async environment. follow the progress of this issue in `Async compatible toolbar project `_. diff --git a/tests/test_integration.py b/tests/test_integration.py index df276d90c..ca31a294c 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -11,7 +11,7 @@ from django.db import connection from django.http import HttpResponse from django.template.loader import get_template -from django.test import RequestFactory +from django.test import AsyncRequestFactory, RequestFactory from django.test.utils import override_settings from debug_toolbar.forms import SignedDataForm @@ -126,6 +126,22 @@ def test_should_render_panels_multiprocess(self): request.META.pop("wsgi.multiprocess") self.assertTrue(toolbar.should_render_panels()) + def test_should_render_panels_asgi(self): + """ + The toolbar not should render the panels on each request when wsgi.multiprocess + is True or missing in case of async context rather than multithreaded + wsgi. + """ + async_request = AsyncRequestFactory().get("/") + # by default ASGIRequest will have wsgi.multiprocess set to True + # but we are still assigning this to true cause this could change + # and we specifically need to check that method returns false even with + # wsgi.multiprocess set to true + async_request.META["wsgi.multiprocess"] = True + toolbar = DebugToolbar(async_request, self.get_response) + toolbar.config["RENDER_PANELS"] = None + self.assertFalse(toolbar.should_render_panels()) + def _resolve_stats(self, path): # takes stats from Request panel request = rf.get(path) From 830c9641d1b4b9b196198d53eca8accee8d3e319 Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Wed, 21 Aug 2024 00:02:52 +0530 Subject: [PATCH 02/20] revert changes --- debug_toolbar/toolbar.py | 15 ++++++--------- docs/architecture.rst | 2 +- tests/test_integration.py | 18 +----------------- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index 921546aaf..35d789a53 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -12,7 +12,6 @@ from django.apps import apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from django.core.handlers.asgi import ASGIRequest from django.dispatch import Signal from django.template import TemplateSyntaxError from django.template.loader import render_to_string @@ -102,14 +101,12 @@ def should_render_panels(self): If False, the panels will be loaded via Ajax. """ if (render_panels := self.config["RENDER_PANELS"]) is None: - # If wsgi.multiprocess is true then it is either being served - # from ASGI or multithreaded third-party WSGI server eg gunicorn. - # we need to make special handling for ASGI for supporting - # async context based requests. - if isinstance(self.request, ASGIRequest): - render_panels = False - else: - render_panels = self.request.META.get("wsgi.multiprocess", True) + # If wsgi.multiprocess isn't in the headers, then it's likely + # being served by ASGI. This type of set up is most likely + # incompatible with the toolbar until + # https://github.com/jazzband/django-debug-toolbar/issues/1430 + # is resolved. + render_panels = self.request.META.get("wsgi.multiprocess", True) return render_panels # Handle storing toolbars in memory and fetching them later on diff --git a/docs/architecture.rst b/docs/architecture.rst index cf5c54951..0043f5153 100644 --- a/docs/architecture.rst +++ b/docs/architecture.rst @@ -82,7 +82,7 @@ Problematic Parts - Support for async and multi-threading: ``debug_toolbar.middleware.DebugToolbarMiddleware`` is now async compatible and can process async requests. However certain panels such as ``SQLPanel``, ``TimerPanel``, - ``RequestPanel`` and ``ProfilingPanel`` aren't fully + ``RequestPanel``, ``HistoryPanel`` and ``ProfilingPanel`` aren't fully compatible and currently being worked on. For now, these panels are disabled by default when running in async environment. follow the progress of this issue in `Async compatible toolbar project `_. diff --git a/tests/test_integration.py b/tests/test_integration.py index ca31a294c..df276d90c 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -11,7 +11,7 @@ from django.db import connection from django.http import HttpResponse from django.template.loader import get_template -from django.test import AsyncRequestFactory, RequestFactory +from django.test import RequestFactory from django.test.utils import override_settings from debug_toolbar.forms import SignedDataForm @@ -126,22 +126,6 @@ def test_should_render_panels_multiprocess(self): request.META.pop("wsgi.multiprocess") self.assertTrue(toolbar.should_render_panels()) - def test_should_render_panels_asgi(self): - """ - The toolbar not should render the panels on each request when wsgi.multiprocess - is True or missing in case of async context rather than multithreaded - wsgi. - """ - async_request = AsyncRequestFactory().get("/") - # by default ASGIRequest will have wsgi.multiprocess set to True - # but we are still assigning this to true cause this could change - # and we specifically need to check that method returns false even with - # wsgi.multiprocess set to true - async_request.META["wsgi.multiprocess"] = True - toolbar = DebugToolbar(async_request, self.get_response) - toolbar.config["RENDER_PANELS"] = None - self.assertFalse(toolbar.should_render_panels()) - def _resolve_stats(self, path): # takes stats from Request panel request = rf.get(path) From 1c39baac18faf0caa2ee0d7044b9e9181c3330f6 Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Wed, 21 Aug 2024 00:35:51 +0530 Subject: [PATCH 03/20] Async compatible --- debug_toolbar/middleware.py | 7 +++++-- debug_toolbar/panels/sql/panel.py | 2 +- docs/architecture.rst | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 03044f3a4..385c5fb9d 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -6,7 +6,7 @@ import socket from functools import lru_cache -from asgiref.sync import iscoroutinefunction, markcoroutinefunction +from asgiref.sync import iscoroutinefunction, markcoroutinefunction, sync_to_async from django.conf import settings from django.utils.module_loading import import_string @@ -112,7 +112,10 @@ async def __acall__(self, request): # Activate instrumentation ie. monkey-patch. for panel in toolbar.enabled_panels: - panel.enable_instrumentation() + if panel.panel_id == "SQLPanel": + await sync_to_async(panel.enable_instrumentation)() + else: + panel.enable_instrumentation() try: # Run panels like Django middleware. response = await toolbar.process_request(request) diff --git a/debug_toolbar/panels/sql/panel.py b/debug_toolbar/panels/sql/panel.py index 7be5c4da6..fec1b6b97 100644 --- a/debug_toolbar/panels/sql/panel.py +++ b/debug_toolbar/panels/sql/panel.py @@ -113,7 +113,7 @@ class SQLPanel(Panel): the request. """ - is_async = False + is_async = True def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/docs/architecture.rst b/docs/architecture.rst index 0043f5153..b2a16802c 100644 --- a/docs/architecture.rst +++ b/docs/architecture.rst @@ -81,8 +81,8 @@ Problematic Parts the main benefit of the toolbar - Support for async and multi-threading: ``debug_toolbar.middleware.DebugToolbarMiddleware`` is now async compatible and can process async requests. However certain - panels such as ``SQLPanel``, ``TimerPanel``, - ``RequestPanel``, ``HistoryPanel`` and ``ProfilingPanel`` aren't fully + panels such as ``TimerPanel``, ``RequestPanel``, + ``HistoryPanel`` and ``ProfilingPanel`` aren't fully compatible and currently being worked on. For now, these panels are disabled by default when running in async environment. follow the progress of this issue in `Async compatible toolbar project `_. From 7e1993f9352a8d9b636bd83a22bb3b66abd15344 Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Tue, 27 Aug 2024 20:42:52 +0530 Subject: [PATCH 04/20] asynchornise instrumentaion internally in panel logic rather than middleware --- debug_toolbar/middleware.py | 6 +++--- debug_toolbar/panels/__init__.py | 3 +++ debug_toolbar/panels/sql/panel.py | 8 ++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 385c5fb9d..1bf9b4e70 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -6,7 +6,7 @@ import socket from functools import lru_cache -from asgiref.sync import iscoroutinefunction, markcoroutinefunction, sync_to_async +from asgiref.sync import iscoroutinefunction, markcoroutinefunction from django.conf import settings from django.utils.module_loading import import_string @@ -112,8 +112,8 @@ async def __acall__(self, request): # Activate instrumentation ie. monkey-patch. for panel in toolbar.enabled_panels: - if panel.panel_id == "SQLPanel": - await sync_to_async(panel.enable_instrumentation)() + if hasattr(panel, "aenable_instrumentation"): + await panel.aenable_instrumentation() else: panel.enable_instrumentation() try: diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index de18f95e3..40b43eaf6 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -154,6 +154,9 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. + + Add aenable_instrumaentation to the Panel class to enable async + instrumentation. """ def disable_instrumentation(self): diff --git a/debug_toolbar/panels/sql/panel.py b/debug_toolbar/panels/sql/panel.py index fec1b6b97..ab500b212 100644 --- a/debug_toolbar/panels/sql/panel.py +++ b/debug_toolbar/panels/sql/panel.py @@ -2,6 +2,7 @@ from collections import defaultdict from copy import copy +from asgiref.sync import sync_to_async from django.db import connections from django.urls import path from django.utils.translation import gettext_lazy as _, ngettext @@ -192,6 +193,13 @@ def get_urls(cls): path("sql_profile/", views.sql_profile, name="sql_profile"), ] + async def aenable_instrumentation(self): + """ + Async version of enable_instrumentation. + For async-capable panels that has async logic for instrumentation + """ + await sync_to_async(self.enable_instrumentation)() + def enable_instrumentation(self): # This is thread-safe because database connections are thread-local. for connection in connections.all(): From a5970f50df03d955716878519385152b7c70f3a7 Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Tue, 27 Aug 2024 20:44:42 +0530 Subject: [PATCH 05/20] fix docstring --- debug_toolbar/panels/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 40b43eaf6..d6f2e5fa8 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,8 +155,8 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable_instrumaentation to the Panel class to enable async - instrumentation. + Add aenable_instrumentation method to the Panel class to support async + instrumentation logic """ def disable_instrumentation(self): From 284c3697be9c26f24e20473aaed2faed5902a9ae Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Tue, 27 Aug 2024 20:48:04 +0530 Subject: [PATCH 06/20] add period in the docstring comment --- debug_toolbar/panels/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index d6f2e5fa8..fd3aff89f 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -156,7 +156,7 @@ def enable_instrumentation(self): called early in ``DebugToolbarMiddleware``. It should be idempotent. Add aenable_instrumentation method to the Panel class to support async - instrumentation logic + instrumentation logic. """ def disable_instrumentation(self): From 263e85695552d4b833f7e50b8cbed8c7840e3336 Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Tue, 27 Aug 2024 21:12:09 +0530 Subject: [PATCH 07/20] mark aenable_instrumentation as mehtod --- debug_toolbar/panels/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index fd3aff89f..135e185ed 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,7 +155,7 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable_instrumentation method to the Panel class to support async + Add ``aenable_instrumentation`` method to the Panel class to support async instrumentation logic. """ From 7bd53143d400d26673a7e9910bc04610f523435e Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Tue, 27 Aug 2024 21:38:04 +0530 Subject: [PATCH 08/20] add asgi and aenable_instrumentation in wordlist --- debug_toolbar/panels/__init__.py | 2 +- docs/spelling_wordlist.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 135e185ed..fd3aff89f 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,7 +155,7 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add ``aenable_instrumentation`` method to the Panel class to support async + Add aenable_instrumentation method to the Panel class to support async instrumentation logic. """ diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 829ff9bec..8d9b27dcb 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -6,7 +6,9 @@ Pympler Roboto Transifex Werkzeug +aenable_instrumentation ajax +asgi async backend backends From 9ecd36d653200544fc22b94ffa39101e6f08d6fc Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Tue, 27 Aug 2024 21:55:09 +0530 Subject: [PATCH 09/20] fix word spelling --- debug_toolbar/panels/__init__.py | 2 +- debug_toolbar/panels/sql/panel.py | 4 ++-- docs/spelling_wordlist.txt | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index fd3aff89f..2b9b0db97 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,7 +155,7 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable_instrumentation method to the Panel class to support async + Add aenable_instrumentation method to the panel class to support async instrumentation logic. """ diff --git a/debug_toolbar/panels/sql/panel.py b/debug_toolbar/panels/sql/panel.py index ab500b212..fe18a9c11 100644 --- a/debug_toolbar/panels/sql/panel.py +++ b/debug_toolbar/panels/sql/panel.py @@ -195,8 +195,8 @@ def get_urls(cls): async def aenable_instrumentation(self): """ - Async version of enable_instrumentation. - For async-capable panels that has async logic for instrumentation + Async version of enable instrumentation. + For async capable panels having async logic for instrumentation. """ await sync_to_async(self.enable_instrumentation)() diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 8d9b27dcb..27b9e579e 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -17,6 +17,7 @@ checkbox contrib dicts django +enable_instrumentation fallbacks flamegraph flatpages From d9dbb9205af796cbfa1c9451e5d5a902a86b6985 Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Tue, 27 Aug 2024 12:34:54 -0500 Subject: [PATCH 10/20] Spelling changes? --- docs/spelling_wordlist.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 27b9e579e..a247c7a7e 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -6,7 +6,7 @@ Pympler Roboto Transifex Werkzeug -aenable_instrumentation +aenable ajax asgi async @@ -17,7 +17,6 @@ checkbox contrib dicts django -enable_instrumentation fallbacks flamegraph flatpages From a6f6b49f5a2e77fa1a26973a8c0fcf90e8d432eb Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sat, 31 Aug 2024 16:13:09 +0530 Subject: [PATCH 11/20] remove docstring from base enable_instrumentation --- debug_toolbar/panels/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 2b9b0db97..de18f95e3 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -154,9 +154,6 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - - Add aenable_instrumentation method to the panel class to support async - instrumentation logic. """ def disable_instrumentation(self): From 6ba6a6de41b2ff7d1734d08a10d3ae4fc7717a8e Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sat, 31 Aug 2024 16:49:27 +0530 Subject: [PATCH 12/20] add the revised docstring back again --- debug_toolbar/panels/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index de18f95e3..96849eb58 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -154,6 +154,9 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. + + Add aenable instrumentation method in panel class in order + to support async intrumentation logic if required. """ def disable_instrumentation(self): From 07f175a1a2ce7fdcd063513b383f7035ae90fe4a Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sat, 31 Aug 2024 16:53:17 +0530 Subject: [PATCH 13/20] aenable for testing lint failures --- debug_toolbar/panels/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 96849eb58..e42815d55 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,7 +155,7 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable instrumentation method in panel class in order + Add instrumentation method in panel class in order to support async intrumentation logic if required. """ From e44b3050e0bf08f0570cffb0daea65d56d9b2b87 Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sat, 31 Aug 2024 16:56:55 +0530 Subject: [PATCH 14/20] remove instrumentation keyword from docs --- debug_toolbar/panels/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index e42815d55..46272119e 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,8 +155,8 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add instrumentation method in panel class in order - to support async intrumentation logic if required. + Add aenable method in panel class in order + to support async logic if required. """ def disable_instrumentation(self): From d954bda360771db94b4640844ed08f695ba9e07f Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sat, 31 Aug 2024 17:12:36 +0530 Subject: [PATCH 15/20] add instrumentation in spelling list --- debug_toolbar/panels/__init__.py | 4 ++-- docs/spelling_wordlist.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 46272119e..39d6f47c4 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,8 +155,8 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable method in panel class in order - to support async logic if required. + Add aenable_instrumentation method in panel class if needed in order + to support async intrumentation logic. """ def disable_instrumentation(self): diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index a247c7a7e..662e6df4f 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -23,6 +23,7 @@ flatpages frontend htmx inlining +instrumentation isort jQuery jinja From 252ae075cf3ac7124dc4dc0162d1a1276a01de4e Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sat, 31 Aug 2024 17:14:19 +0530 Subject: [PATCH 16/20] remove underscore --- debug_toolbar/panels/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 39d6f47c4..0baaa69db 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,7 +155,7 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable_instrumentation method in panel class if needed in order + Add aenable instrumentation method in panel class if needed in order to support async intrumentation logic. """ From bde0bedb4f90cd308b79751593b5fdf49f68890e Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sat, 31 Aug 2024 17:16:39 +0530 Subject: [PATCH 17/20] remove instrumentation --- debug_toolbar/panels/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 0baaa69db..8c470ea2a 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,8 +155,8 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable instrumentation method in panel class if needed in order - to support async intrumentation logic. + Add aenable method in panel class if needed in order + to support async logic. """ def disable_instrumentation(self): From bae89e6be8b169d39431e06c7489cf7d1a56b760 Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sun, 1 Sep 2024 00:02:46 +0530 Subject: [PATCH 18/20] add instrumentation word in docstring --- debug_toolbar/panels/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 8c470ea2a..f9e5c9ab0 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -156,7 +156,7 @@ def enable_instrumentation(self): called early in ``DebugToolbarMiddleware``. It should be idempotent. Add aenable method in panel class if needed in order - to support async logic. + to support async logic for instrumentation. """ def disable_instrumentation(self): From e406cf830bd739eacb3f1db8b39448453234059e Mon Sep 17 00:00:00 2001 From: Aman Pandey Date: Sun, 1 Sep 2024 00:07:24 +0530 Subject: [PATCH 19/20] add instrumentation word in docstring --- debug_toolbar/panels/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index f9e5c9ab0..e83196696 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,7 +155,7 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable method in panel class if needed in order + Add aenable instrumentation method in panel class if needed in order to support async logic for instrumentation. """ From 0532e7a4587eec2a0f3e1a4dec7d1306f91f59de Mon Sep 17 00:00:00 2001 From: Tim Schilling Date: Sun, 1 Sep 2024 19:27:49 -0500 Subject: [PATCH 20/20] Update language for enable_instrumentation docstring. --- debug_toolbar/panels/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index e83196696..217708ec2 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -155,7 +155,7 @@ def enable_instrumentation(self): Unless the toolbar or this panel is disabled, this method will be called early in ``DebugToolbarMiddleware``. It should be idempotent. - Add aenable instrumentation method in panel class if needed in order + Add the ``aenable_instrumentation`` method to a panel subclass to support async logic for instrumentation. """