Browse files

Add some statsd calls for mostly deletes.

  • Loading branch information...
1 parent 7e55718 commit cdb295819e01abd1b903e0483e427565988b701a @rlr rlr committed Feb 24, 2014
Showing with 20 additions and 0 deletions.
  1. +5 −0 kitsune/forums/views.py
  2. +6 −0 kitsune/kbforums/views.py
  3. +9 −0 kitsune/questions/views.py
View
5 kitsune/forums/views.py
@@ -334,6 +334,8 @@ def delete_thread(request, forum_slug, thread_id):
(request.user, thread.id))
thread.delete()
+ statsd.incr('forums.delete_thread')
+
return HttpResponseRedirect(reverse('forums.threads', args=[forum_slug]))
@@ -428,6 +430,9 @@ def delete_post(request, forum_slug, thread_id, post_id):
log.warning("User %s is deleting post with id=%s" %
(request.user, post.id))
post.delete()
+
+ statsd.incr('forums.delete_post')
+
try:
Thread.objects.get(pk=thread_id)
goto = reverse('forums.posts', args=[forum_slug, thread_id])
View
6 kitsune/kbforums/views.py
@@ -281,6 +281,8 @@ def delete_thread(request, document_slug, thread_id):
(request.user, thread.id))
thread.delete()
+ statsd.incr('kbforums.delete_thread')
+
return HttpResponseRedirect(reverse('wiki.discuss.threads',
args=[document_slug]))
@@ -338,6 +340,10 @@ def delete_post(request, document_slug, thread_id, post_id):
log.warning("User %s is deleting KB post with id=%s" %
(request.user, post.id))
post.delete()
+
+ statsd.incr('kbforums.delete_post')
+
+
try:
Thread.objects.get(pk=thread_id)
goto = reverse('wiki.discuss.posts',
View
9 kitsune/questions/views.py
@@ -1085,6 +1085,8 @@ def delete_question(request, question_id):
(request.user, question.id))
question.delete()
+ statsd.incr('questions.delete')
+
return HttpResponseRedirect(reverse('questions.questions'))
@@ -1106,6 +1108,8 @@ def delete_answer(request, question_id, answer_id):
(request.user, answer.id))
answer.delete()
+ statsd.incr('questions.delete_answer')
+
return HttpResponseRedirect(reverse('questions.answers',
args=[question_id]))
@@ -1124,6 +1128,11 @@ def lock_question(request, question_id):
(request.user, question.is_locked, question.id))
question.save()
+ if question.is_locked:
+ statsd.incr('questions.lock')
+ else:
+ statsd.incr('questions.unlock')
+
return HttpResponseRedirect(question.get_absolute_url())

0 comments on commit cdb2958

Please sign in to comment.