Permalink
Browse files

[bug 723930] Time search per engine.

  • Loading branch information...
1 parent 124e4ba commit a836aa5dedecf070be0d8e8584285be2b57f6494 James Socol committed with rlr Feb 3, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 apps/search/views.py
View
@@ -46,6 +46,10 @@ def jsonp_is_valid(func):
def search(request, template=None):
"""Performs search or displays the search form."""
+ # Time ES and Sphinx separate. See bug 723930.
+ # TODO: Remove this once Sphinx is gone.
+ start = time.time()
+
# JSON-specific variables
is_json = (request.GET.get('format') == 'json')
callback = request.GET.get('callback', '').strip()
@@ -419,6 +423,12 @@ def search(request, template=None):
.strftime(expires_fmt)
results_.set_cookie(settings.LAST_SEARCH_COOKIE, urlquote(cleaned['q']),
max_age=3600, secure=False, httponly=False)
+
+ # Send timing information for each engine. Bug 723930.
+ # TODO: Remove this once Sphinx is gone.
+ dt = (time.time() - start) * 1000
+ statsd.timing('search.%s.view' % engine, int(dt))
+
return results_

0 comments on commit a836aa5

Please sign in to comment.