Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
9ec94cf3
Commit
9ec94cf3
authored
Mar 30, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7504 from cpennington/xblock-duration-histogram
Record durations of xblock views and handlers
parents
2e380c71
b6e1e25b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
common/lib/xmodule/xmodule/x_module.py
+22
-5
No files found.
common/lib/xmodule/xmodule/x_module.py
View file @
9ec94cf3
import
logging
import
os
import
sys
import
time
import
yaml
from
contracts
import
contract
,
new_contract
...
...
@@ -37,6 +38,7 @@ import dogstats_wrapper as dog_stats_api
log
=
logging
.
getLogger
(
__name__
)
XMODULE_METRIC_NAME
=
'edxapp.xmodule'
XMODULE_DURATION_METRIC_NAME
=
XMODULE_METRIC_NAME
+
'.duration'
# Stats event sent to DataDog in order to determine if old XML parsing can be deprecated.
DEPRECATION_VSCOMPAT_EVENT
=
'deprecation.vscompat'
...
...
@@ -1165,6 +1167,7 @@ class MetricsMixin(object):
"""
def
render
(
self
,
block
,
view_name
,
context
=
None
):
start_time
=
time
.
time
()
try
:
status
=
"success"
return
super
(
MetricsMixin
,
self
)
.
render
(
block
,
view_name
,
context
=
context
)
...
...
@@ -1174,17 +1177,24 @@ class MetricsMixin(object):
raise
finally
:
end_time
=
time
.
time
()
course_id
=
getattr
(
self
,
'course_id'
,
''
)
dog_stats_api
.
increment
(
XMODULE_METRIC_NAME
,
tags
=
[
tags
=
[
u'view_name:{}'
.
format
(
view_name
),
u'action:render'
,
u'action_status:{}'
.
format
(
status
),
u'course_id:{}'
.
format
(
course_id
),
u'block_type:{}'
.
format
(
block
.
scope_ids
.
block_type
)
])
]
dog_stats_api
.
increment
(
XMODULE_METRIC_NAME
,
tags
=
tags
)
dog_stats_api
.
histogram
(
XMODULE_DURATION_METRIC_NAME
,
end_time
-
start_time
,
tags
=
tags
)
def
handle
(
self
,
block
,
handler_name
,
request
,
suffix
=
''
):
handle
=
None
start_time
=
time
.
time
()
try
:
status
=
"success"
return
super
(
MetricsMixin
,
self
)
.
handle
(
block
,
handler_name
,
request
,
suffix
=
suffix
)
...
...
@@ -1194,14 +1204,21 @@ class MetricsMixin(object):
raise
finally
:
end_time
=
time
.
time
()
course_id
=
getattr
(
self
,
'course_id'
,
''
)
dog_stats_api
.
increment
(
XMODULE_METRIC_NAME
,
tags
=
[
tags
=
[
u'handler_name:{}'
.
format
(
handler_name
),
u'action:handle'
,
u'action_status:{}'
.
format
(
status
),
u'course_id:{}'
.
format
(
course_id
),
u'block_type:{}'
.
format
(
block
.
scope_ids
.
block_type
)
])
]
dog_stats_api
.
increment
(
XMODULE_METRIC_NAME
,
tags
=
tags
)
dog_stats_api
.
histogram
(
XMODULE_DURATION_METRIC_NAME
,
end_time
-
start_time
,
tags
=
tags
)
class
DescriptorSystem
(
MetricsMixin
,
ConfigurableFragmentWrapper
,
Runtime
):
# pylint: disable=abstract-method
...
...
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