Commit f6b31d26 authored by Vincent Pelletier's avatar Vincent Pelletier

Add no-module stat line.

parent 1b74aad6
...@@ -220,10 +220,11 @@ class ERP5SiteStats(GenericSiteStats): ...@@ -220,10 +220,11 @@ class ERP5SiteStats(GenericSiteStats):
super(ERP5SiteStats, self).__init__(threshold, prefix=prefix) super(ERP5SiteStats, self).__init__(threshold, prefix=prefix)
# Key levels: # Key levels:
# - module id (string) # - module id (string)
# - date (datetime.date)
# - is document (bool) # - is document (bool)
# - date (datetime.date)
self.module = defaultdict(partial(defaultdict, partial( self.module = defaultdict(partial(defaultdict, partial(
defaultdict, partial(APDEXStats, threshold)))) defaultdict, partial(APDEXStats, threshold))))
self.no_module = defaultdict(partial(APDEXStats, threshold))
def accumulate(self, match, url_match, date): def accumulate(self, match, url_match, date):
prefix = self.prefix prefix = self.prefix
...@@ -232,7 +233,9 @@ class ERP5SiteStats(GenericSiteStats): ...@@ -232,7 +233,9 @@ class ERP5SiteStats(GenericSiteStats):
module = split[0] module = split[0]
if module.endswith('_module'): if module.endswith('_module'):
super(ERP5SiteStats, self).accumulate(match, url_match, date) super(ERP5SiteStats, self).accumulate(match, url_match, date)
self.module[module][date][len(split) > 2].accumulate(match) self.module[module][len(split) > 2][date].accumulate(match)
else:
self.no_module[date].accumulate(match)
def asHTML(self): def asHTML(self):
result = [] result = []
...@@ -259,22 +262,23 @@ class ERP5SiteStats(GenericSiteStats): ...@@ -259,22 +262,23 @@ class ERP5SiteStats(GenericSiteStats):
getClassForDuration(data.duration_max, self.threshold), getClassForDuration(data.duration_max, self.threshold),
float(data.duration_max) / US_PER_S, float(data.duration_max) / US_PER_S,
) )
def apdexAsColumns(caption, is_document, data_dict): def apdexAsColumns(data_dict):
append('<td>%s</td>' % caption)
data_total = APDEXStats(self.threshold) data_total = APDEXStats(self.threshold)
for data in data_dict.values(): for data in data_dict.values():
data_total.accumulateFrom(data[is_document]) data_total.accumulateFrom(data)
append(apdexStatsAsHtml(data_total)) append(apdexStatsAsHtml(data_total))
for date in column_list: for date in column_list:
append(apdexStatsAsHtml(data_dict[date][is_document])) append(apdexStatsAsHtml(data_dict[date]))
append('</tr>')
for module_id, data_dict in sorted(self.module.iteritems(), for module_id, data_dict in sorted(self.module.iteritems(),
key=ITEMGETTER0): key=ITEMGETTER0):
append('<tr><td rowspan="2">%s</td>' % module_id) append('<tr><th rowspan="2">%s</th><th>module</th>' % module_id)
apdexAsColumns('module', False, data_dict) apdexAsColumns(data_dict[False])
append('<tr>') append('</tr><tr><th>document</th>')
apdexAsColumns('document', True, data_dict) apdexAsColumns(data_dict[True])
append('</table>') append('</tr>')
append('<tr><th colspan="2">(none)</th>')
apdexAsColumns(self.no_module)
append('</tr></table>')
append(super(ERP5SiteStats, self).asHTML()) append(super(ERP5SiteStats, self).asHTML())
return '\n'.join(result) return '\n'.join(result)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment