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
4b9df2e9
Commit
4b9df2e9
authored
Sep 06, 2013
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add datadog tracking for bulk email
parent
3b627e8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
lms/djangoapps/bulk_email/tasks.py
+10
-1
No files found.
lms/djangoapps/bulk_email/tasks.py
View file @
4b9df2e9
...
...
@@ -16,6 +16,7 @@ from celery import task, current_task
from
celery.utils.log
import
get_task_logger
from
django.core.urlresolvers
import
reverse
from
statsd
import
statsd
from
dogapi
import
dog_stats_api
from
bulk_email.models
import
(
CourseEmail
,
Optout
,
CourseEmailTemplate
,
...
...
@@ -116,6 +117,13 @@ def course_email(email_id, to_list, course_title, course_url, image_url, throttl
Sends to all addresses contained in to_list. Emails are sent multi-part, in both plain
text and html.
"""
with
dog_stats_api
.
timer
(
'course_email.single_task.time.overall'
,
tags
=
[
_statsd_tag
(
course_title
)]):
_send_course_email
(
email_id
,
to_list
,
course_title
,
course_url
,
image_url
,
throttle
)
def
_send_course_email
(
email_id
,
to_list
,
course_title
,
course_url
,
image_url
,
throttle
):
"""
Performs the email sending task.
"""
try
:
msg
=
CourseEmail
.
objects
.
get
(
id
=
email_id
)
except
CourseEmail
.
DoesNotExist
:
...
...
@@ -181,7 +189,8 @@ def course_email(email_id, to_list, course_title, course_url, image_url, throttl
time
.
sleep
(
0.2
)
try
:
connection
.
send_messages
([
email_msg
])
with
dog_stats_api
.
timer
(
'course_email.single_send.time.overall'
,
tags
=
[
_statsd_tag
(
course_title
)]):
connection
.
send_messages
([
email_msg
])
statsd
.
increment
(
'course_email.sent'
,
tags
=
[
_statsd_tag
(
course_title
)])
...
...
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