Skip to content

Commit

Permalink
[bug 723930] Time search per engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Socol authored and rlr committed Feb 3, 2012
1 parent 124e4ba commit a836aa5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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_


Expand Down

0 comments on commit a836aa5

Please sign in to comment.