Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-debug-toolbar-mongo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-debug-toolbar-mongo
Commits
13957ffa
Commit
13957ffa
authored
Jun 13, 2013
by
Colin Howe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track getmore operations
parent
a3ecfa94
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
debug_toolbar_mongo/__init__.py
+1
-1
debug_toolbar_mongo/operation_tracker.py
+9
-4
debug_toolbar_mongo/templates/mongo-panel.html
+2
-0
No files found.
debug_toolbar_mongo/__init__.py
View file @
13957ffa
# following PEP 386, versiontools will pick it up
# following PEP 386, versiontools will pick it up
__version__
=
(
0
,
1
,
9
,
"final"
,
0
)
__version__
=
(
0
,
1
,
10
,
"final"
,
0
)
debug_toolbar_mongo/operation_tracker.py
View file @
13957ffa
...
@@ -128,13 +128,10 @@ def _cursor_refresh(cursor_self):
...
@@ -128,13 +128,10 @@ def _cursor_refresh(cursor_self):
def
privar
(
name
):
def
privar
(
name
):
return
getattr
(
cursor_self
,
'_Cursor__{0}'
.
format
(
name
))
return
getattr
(
cursor_self
,
'_Cursor__{0}'
.
format
(
name
))
if
privar
(
'id'
)
is
not
None
:
# getMore not query - move on
return
_original_methods
[
'refresh'
](
cursor_self
)
# NOTE: See pymongo/cursor.py+557 [_refresh()] and
# NOTE: See pymongo/cursor.py+557 [_refresh()] and
# pymongo/message.py for where information is stored
# pymongo/message.py for where information is stored
is_getmore
=
privar
(
'id'
)
is
not
None
# Time the actual query
# Time the actual query
start_time
=
time
.
time
()
start_time
=
time
.
time
()
result
=
_original_methods
[
'refresh'
](
cursor_self
)
result
=
_original_methods
[
'refresh'
](
cursor_self
)
...
@@ -149,6 +146,13 @@ def _cursor_refresh(cursor_self):
...
@@ -149,6 +146,13 @@ def _cursor_refresh(cursor_self):
'stack_trace'
:
_get_stacktrace
(),
'stack_trace'
:
_get_stacktrace
(),
}
}
if
is_getmore
:
# getMore not query - move on
query_data
[
'cursor'
]
=
id
(
cursor_self
)
query_data
[
'operation'
]
=
'getmore'
queries
.
append
(
query_data
)
return
result
# Collection in format <db_name>.<collection_name>
# Collection in format <db_name>.<collection_name>
collection_name
=
privar
(
'collection'
)
collection_name
=
privar
(
'collection'
)
query_data
[
'collection'
]
=
collection_name
.
full_name
.
split
(
'.'
)[
1
]
query_data
[
'collection'
]
=
collection_name
.
full_name
.
split
(
'.'
)[
1
]
...
@@ -178,6 +182,7 @@ def _cursor_refresh(cursor_self):
...
@@ -178,6 +182,7 @@ def _cursor_refresh(cursor_self):
query_data
[
'limit'
]
=
abs
(
privar
(
'limit'
)
or
0
)
query_data
[
'limit'
]
=
abs
(
privar
(
'limit'
)
or
0
)
query_data
[
'query'
]
=
query_son
.
get
(
'$query'
)
or
query_son
query_data
[
'query'
]
=
query_son
.
get
(
'$query'
)
or
query_son
query_data
[
'ordering'
]
=
_get_ordering
(
query_son
)
query_data
[
'ordering'
]
=
_get_ordering
(
query_son
)
query_data
[
'cursor'
]
=
id
(
cursor_self
)
queries
.
append
(
query_data
)
queries
.
append
(
query_data
)
...
...
debug_toolbar_mongo/templates/mongo-panel.html
View file @
13957ffa
...
@@ -38,6 +38,7 @@ table.mongo-op-table tbody {
...
@@ -38,6 +38,7 @@ table.mongo-op-table tbody {
<tr>
<tr>
<th>
Time (ms)
</th>
<th>
Time (ms)
</th>
<th>
Operation
</th>
<th>
Operation
</th>
<th>
Cursor
</th>
<th>
Collection
</th>
<th>
Collection
</th>
<th
style=
"width: 100%"
>
Query
</th>
<th
style=
"width: 100%"
>
Query
</th>
<th>
Ordering
</th>
<th>
Ordering
</th>
...
@@ -51,6 +52,7 @@ table.mongo-op-table tbody {
...
@@ -51,6 +52,7 @@ table.mongo-op-table tbody {
<tr
class=
"{% cycle 'djDebugOdd' 'djDebugEven' %}"
>
<tr
class=
"{% cycle 'djDebugOdd' 'djDebugEven' %}"
>
<td>
{{ query.time|floatformat:"4" }}
</td>
<td>
{{ query.time|floatformat:"4" }}
</td>
<td>
{{ query.operation|title }}
</td>
<td>
{{ query.operation|title }}
</td>
<td>
{{ query.cursor }}
</td>
<td>
{{ query.collection }}
</td>
<td>
{{ query.collection }}
</td>
<td>
<td>
{% if query.query %}
{% if query.query %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment