Commit 14a2c7e
committed
Remove duplicate query logging that breaks Django's assertNumQueries
The SqlCommenter _QueryWrapper manually appends the SQL string to
queries_log when a CursorDebugWrapper is active. However,
CursorDebugWrapper.debug_sql already logs the query as a dict with
"sql" and "time" keys. This causes two problems:
1. Queries are double-counted in queries_log
2. The raw string entries cause a TypeError in Django's
assertNumQueries, which expects dict entries with a "sql" key
Remove the manual append and let Django handle query logging.1 parent 195bcdb commit 14a2c7e
File tree
2 files changed
+2
-5
lines changed- instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware
2 files changed
+2
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
122 | 121 | | |
123 | 122 | | |
124 | 123 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 124 | | |
0 commit comments