Closed
Bug 859881
Opened 12 years ago
Closed 12 years ago
catch any error from the monolith client
Categories
(Marketplace Graveyard :: Statistics, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
2013-04-25
People
(Reporter: tarek, Assigned: tarek)
Details
we should probably catch ValueError exceptions and just send back an empty list with a logger.error() call.
ValueError: None
sentry dump
django/core/handlers/base.py ? in get_response
if response:
break
if response is None:
try:
response = callback(request, *callback_args, **callback_kwargs)
except Exception, e:
# If the view raised an exception, run it through exception
# middleware, and if the exception middleware returns a
# response, use that. Otherwise, reraise the exception.
for middleware_method in self._exception_middleware:
callback
<function site_series at 0x5698b90>
callback_args
[]
callback_kwargs
end
u'20130409'
field
'apps_count_new'
format
u'json'
group
u'day'
start
u'20130326'
Expand Context (10 hidden)
stats/views.py ? in site_series (application)
def site_series(request, format, group, start, end, field):
"""Pull a single field from the site_query data"""
start, end = get_daterange_or_404(start, end)
group = 'date' if group == 'day' else group
series = []
full_series, keys = _site_query(group, start, end, field)
for row in full_series:
if field in row['data']:
series.append({
'date': row['date'],
'count': row['data'][field],
end
datetime.date(2013, 4, 9)
field
apps_count_new
format
json
Expand Context (4 hidden)
amo/utils.py ? in wrapper (application)
def wrapper(*args, **kwargs):
key = memoize_key(prefix, *args, **kwargs)
data = cache.get(key)
if data is not None:
return data
data = func(*args, **kwargs)
cache.set(key, data, time)
return data
return wrapper
return decorator
args
["'date'", "'datetime.date(2013, 3, 26)'", "'datetime.date(2013, 4, 9)'", "'apps_count_new'"]
data
None
func
<function _site_query at 0x5698a28>
Expand Context (4 hidden)
stats/views.py ? in _site_query (application)
@memoize(prefix='global_stats', time=60 * 60)
def _site_query(period, start, end, field=None):
if waffle.switch_is_active('monolith-stats'):
res = _monolith_site_query(period, start, end, field)
return res
cursor = connection.cursor()
# Let MySQL make this fast. Make sure we prevent SQL injection with the
# assert.
end
datetime.date(2013, 4, 9)
field
apps_count_new
period
date
start
datetime.date(2013, 3, 26)
stats/views.py ? in _monolith_site_query (application)
def _get_data():
for result in client(fields[field], start, end, interval=period):
yield {'date': result['date'].strftime('%Y-%m-%d'),
'data': {field: result['count']}}
return list(_get_data()), _CACHED_KEYS
@memoize(prefix='global_stats', time=60 * 60)
def _site_query(period, start, end, field=None):
if waffle.switch_is_active('monolith-stats'):
_get_data
<function _get_data at 0x69acaa0>
client
<monolith.client.Client object at 0x66ddcd0>
end
datetime.date(2013, 4, 9)
Expand Context (4 hidden)
stats/views.py ? in _get_data (application)
if period == 'date':
period = 'day'
def _get_data():
for result in client(fields[field], start, end, interval=period):
yield {'date': result['date'].strftime('%Y-%m-%d'),
'data': {field: result['count']}}
return list(_get_data()), _CACHED_KEYS
client
<monolith.client.Client object at 0x66ddcd0>
end
datetime.date(2013, 4, 9)
field
apps_count_new
Expand Context (3 hidden)
/data/www/addons-dev.allizom.org/venv/lib/python2.6/site-packages/monolith/client/__init__.py ? in __call__
# statsd calls
self.statsd.incr('elasticsearch-call')
if not isinstance(res, dict):
raise ValueError(res)
if 'errors' in res:
raise ValueError(res['errors'][0]['description'])
dates = set()
drange
<generator object <genexpr> at 0x6630690>
end
datetime.date(2013, 4, 9)
end_date_str
2013-04-09
Expand Context (8 hidden)
Replay this request
Request
Comment 1•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•12 years ago
|
Assignee: nobody → tarek
Target Milestone: --- → 2013-04-25
You need to log in
before you can comment on or make changes to this bug.
Description
•