Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added the old_version flag.

You can use this flag to get the old data in the json/csv views.
That's useful to compare data on the fly between the monolith-based
metrics and the old metrics.
  • Loading branch information...
commit dc56507a12b4f369237a2c5ca5bc484f38546daf 1 parent 423dbd0
Tarek Ziade tarekziade authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 apps/stats/views.py
10 apps/stats/views.py
View
@@ -514,8 +514,10 @@ def _get_data():
@memoize(prefix='global_stats', time=60 * 60)
-def _site_query(period, start, end, field=None):
- if waffle.switch_is_active('monolith-stats'):
+def _site_query(period, start, end, field=None, request=None):
+ old_version = request and request.GET.get('old_version', '0') or '0'
+
+ if waffle.switch_is_active('monolith-stats') and old_version == '0':
res = _monolith_site_query(period, start, end, field)
return res
@@ -556,7 +558,7 @@ def site(request, format, group, start=None, end=None):
group = 'date' if group == 'day' else group
start, end = get_daterange_or_404(start, end)
- series, keys = _site_query(group, start, end)
+ series, keys = _site_query(group, start, end, request)
if format == 'csv':
return render_csv(request, None, series, ['date'] + keys,
@@ -586,7 +588,7 @@ def site_series(request, format, group, start, end, field):
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)
+ full_series, keys = _site_query(group, start, end, field, request)
for row in full_series:
if field in row['data']:
series.append({
Please sign in to comment.
Something went wrong with that request. Please try again.