Permalink
Browse files

More statsd counters please, bug 698799

  • Loading branch information...
1 parent faec9c3 commit aeeb54b3fb34ac5db8564c78b377db400511ecee @davedash davedash committed Nov 3, 2011
Showing with 12 additions and 0 deletions.
  1. +4 −0 apps/feedback/validators.py
  2. +3 −0 apps/search/client.py
  3. +5 −0 apps/search/views.py
View
4 apps/feedback/validators.py
@@ -6,6 +6,7 @@
from django.utils.html import strip_tags
from product_details import product_details
+from statsd import statsd
from tower import ugettext as _
import swearwords
@@ -34,6 +35,9 @@ def validate_swearwords(str):
"""Soft swear word filter to encourage contructive feedback."""
matches = swearwords.find_swearwords(str)
if matches:
+ statsd.incr('swearing.total')
+ for match in matches:
+ statsd.incr('swearing.%s' % match)
# L10n: "Swear words" are cuss words/offensive words.
raise ValidationError(
_('Your comment contains swear words (%s). In order to help us '
View
3 apps/search/client.py
@@ -11,6 +11,7 @@
from django.conf import settings
from product_details import product_details
+from statsd import statsd
from tower import ugettext as _
from input import (KNOWN_DEVICES, KNOWN_MANUFACTURERS, OPINION_PRAISE,
@@ -213,9 +214,11 @@ def query(self, term, limit=20, offset=0, **kwargs):
try:
results = sc.RunQueries()
except socket.timeout:
+ statsd.incr('sphinx.errors.timeout')
raise SearchError(_("Query has timed out."))
except Exception, e:
# L10n: Sphinx is the name of the search engine software.
+ statsd.incr('sphinx.errors.unknown')
raise SearchError(_("Sphinx threw an unknown exception: %s") % e)
if sc.GetLastError():
View
5 apps/search/views.py
@@ -11,6 +11,7 @@
import commonware.log
from product_details.version_compare import Version
+from statsd import statsd
from tower import ugettext as _, ugettext_lazy as _lazy
from input import (PRODUCTS, PRODUCT_IDS, FIREFOX, MOBILE, LATEST_BETAS,
@@ -218,6 +219,10 @@ def index(request):
page = form.data.get('page', 1)
+ # Are people going past the first page?
+ if page > 1:
+ statsd.incr('search.paginating')
+
# Get the desktop site's absolute URL for use in the settings tab
desktop_site = Site.objects.get(id=settings.DESKTOP_SITE_ID)

0 comments on commit aeeb54b

Please sign in to comment.