Skip to content

Commit 817eb2e

Browse files
committed
Fix query times and remove unused features
1 parent ee088f8 commit 817eb2e

File tree

4 files changed

+3
-39
lines changed

4 files changed

+3
-39
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,3 @@ repos:
1414
- id: ruff
1515
args: [ --fix ]
1616
- id: ruff-format
17-
18-
- repo: https://github.com/djlint/djLint
19-
rev: v1.36.3
20-
hooks:
21-
- id: djlint-reformat-django
22-
- id: djlint-django

django_mongodb_extensions/debug_toolbar/panels/mql/panel.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ def disable_instrumentation(self):
5858
def generate_stats(self, request, response):
5959
self.record_stats(
6060
{
61-
"databases": sorted(self._databases.items()),
6261
"queries": self._queries,
63-
"sql_time": self._sql_time,
6462
}
6563
)

django_mongodb_extensions/debug_toolbar/panels/mql/tracking.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ def log(self, op, duration, args, kwargs=None):
3232
args = ", ".join(repr(arg) for arg in args)
3333
operation = f"db.{self.collection_name}{op}({args})"
3434
if self.logger:
35+
self.logger._sql_time += duration
3536
self.logger._queries.append(
3637
{
38+
"alias": self.db.alias,
3739
"sql": operation,
38-
"time": "%.3f" % duration,
40+
"duration": "%.3f" % duration,
3941
}
4042
)
4143
self.logger._databases[self.db.alias] = {

django_mongodb_extensions/templates/debug_toolbar/panels/mql.html

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,12 @@
2424
<col>
2525
<col>
2626
<col>
27-
<col class="djdt-width-30">
28-
<col>
29-
<col>
3027
</colgroup>
3128
<thead>
3229
<tr>
3330
<th></th>
3431
<th colspan="2">{% trans "Query" %}</th>
35-
<th>{% trans "Timeline" %}</th>
3632
<th>{% trans "Time (ms)" %}</th>
37-
<th>{% trans "Action" %}</th>
3833
</tr>
3934
</thead>
4035
<tbody>
@@ -59,34 +54,9 @@
5954
</strong>
6055
{% endif %}
6156
</td>
62-
<td>
63-
<svg class="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %}{% if query.in_trans %} djDebugLineChartInTransaction{% endif %}" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none" aria-label="{{ query.width_ratio }}%">
64-
<rect x="{{ query.start_offset|unlocalize }}" y="0" height="5" width="{{ query.width_ratio|unlocalize }}" fill="{{ query.trace_color }}" />
65-
{% if query.starts_trans %}
66-
<line x1="{{ query.start_offset|unlocalize }}" y1="0" x2="{{ query.start_offset|unlocalize }}" y2="5" />
67-
{% endif %}
68-
{% if query.ends_trans %}
69-
<line x1="{{ query.end_offset|unlocalize }}" y1="0" x2="{{ query.end_offset|unlocalize }}" y2="5" />
70-
{% endif %}
71-
</svg>
72-
</td>
7357
<td class="djdt-time">
7458
{{ query.duration|floatformat:"2" }}
7559
</td>
76-
<td class="djdt-actions">
77-
{% if query.params %}
78-
{% if query.is_select %}
79-
<form method="post">
80-
{{ query.form.as_div }}
81-
<button formaction="{% url 'djdt:sql_select' %}" class="remoteCall">Sel</button>
82-
<button formaction="{% url 'djdt:sql_explain' %}" class="remoteCall">Expl</button>
83-
{% if query.vendor == 'mysql' %}
84-
<button formaction="{% url 'djdt:sql_profile' %}" class="remoteCall">Prof</button>
85-
{% endif %}
86-
</form>
87-
{% endif %}
88-
{% endif %}
89-
</td>
9060
</tr>
9161
<tr class="djUnselected {% if query.is_slow %} djDebugRowWarning{% endif %} djToggleDetails_{{ forloop.counter }}" id="sqlDetails_{{ forloop.counter }}">
9262
<td colspan="2"></td>

0 commit comments

Comments
 (0)