Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
23b76a60
Commit
23b76a60
authored
4 years ago
by
Troy Sankey
Browse files
Options
Downloads
Patches
Plain Diff
Add more monitoring to the CourseIdList view
parent
126f777c
Branches
Branches containing commit
Tags
release-2020-07-02-10.30
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/course_api/serializers.py
+7
-2
7 additions, 2 deletions
lms/djangoapps/course_api/serializers.py
lms/djangoapps/course_api/views.py
+42
-0
42 additions, 0 deletions
lms/djangoapps/course_api/views.py
with
49 additions
and
2 deletions
lms/djangoapps/course_api/serializers.py
+
7
−
2
View file @
23b76a60
...
...
@@ -3,7 +3,7 @@ Course API Serializers. Representing course catalog data
"""
from
edx_django_utils
.
monitoring
import
function_trace
from
edx_django_utils
import
monitoring
as
monitoring_utils
import
six.moves.urllib.error
import
six.moves.urllib.parse
import
six.moves.urllib.request
...
...
@@ -129,6 +129,11 @@ class CourseKeySerializer(serializers.BaseSerializer): # pylint:disable=abstrac
Serializer that takes a CourseKey and serializes it to a string course_id.
"""
@
function_trace
(
'
to_representation
'
)
@
monitoring_utils.function_trace
(
'
course_key_serializer_
to_representation
'
)
def
to_representation
(
self
,
instance
):
# The function trace should be counting calls to this function, but I
# couldn't find it when I looked in any of the NR transaction traces,
# so I'm manually counting them using a custom metric:
monitoring_utils
.
increment
(
'
course_key_serializer_to_representation_call_count
'
)
return
str
(
instance
)
This diff is collapsed.
Click to expand it.
lms/djangoapps/course_api/views.py
+
42
−
0
View file @
23b76a60
...
...
@@ -381,3 +381,45 @@ class CourseIdListView(DeveloperErrorViewMixin, ListAPIView):
form
.
cleaned_data
[
'
username
'
],
role
=
form
.
cleaned_data
[
'
role
'
],
)
@function_trace
(
'
paginate_queryset
'
)
def
paginate_queryset
(
self
,
*
args
,
**
kwargs
):
"""
No-op passthrough function purely for function-tracing (monitoring)
purposes.
This should be called once per GET request.
"""
return
super
(
CourseIdListView
,
self
).
paginate_queryset
(
*
args
,
**
kwargs
)
@function_trace
(
'
get_paginated_response
'
)
def
get_paginated_response
(
self
,
*
args
,
**
kwargs
):
"""
No-op passthrough function purely for function-tracing (monitoring)
purposes.
This should be called only when the response is paginated. Two pages
means two GET requests and one function call per request. Otherwise, if
the whole response fits in one page, this function never gets called.
"""
return
super
(
CourseIdListView
,
self
).
get_paginated_response
(
*
args
,
**
kwargs
)
@function_trace
(
'
filter_queryset
'
)
def
filter_queryset
(
self
,
*
args
,
**
kwargs
):
"""
No-op passthrough function purely for function-tracing (monitoring)
purposes.
This should be called once per GET request.
"""
return
super
(
CourseIdListView
,
self
).
filter_queryset
(
*
args
,
**
kwargs
)
@function_trace
(
'
get_serializer
'
)
def
get_serializer
(
self
,
*
args
,
**
kwargs
):
"""
No-op passthrough function purely for function-tracing (monitoring)
purposes.
This should be called once per GET request.
"""
return
super
(
CourseIdListView
,
self
).
get_serializer
(
*
args
,
**
kwargs
)
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment