Adding responseCodes to summary for graphit and summary HTML page (#944)

* Adding responseCodes to summary for graphite

* Adding 200, 301, and 404 response counts to summary html page
This commit is contained in:
Jonathan Lee 2016-05-22 03:45:57 -04:00 committed by Peter Hedenskog
parent e2bbdb8715
commit ebe3f59777
2 changed files with 26 additions and 2 deletions

View File

@ -21,6 +21,10 @@ module.exports = {
});
})
Object.keys(summary.responseCodes).forEach(function(responseCode) {
statsHelpers.pushStats(stats, 'responseCodes.' + responseCode, summary.responseCodes[responseCode]);
});
// extras for firstParty vs third
if (summary.firstParty.requests) {
METRIC_NAMES.forEach(function(metric) {
@ -48,6 +52,12 @@ module.exports = {
});
});
summary[name] = contentTypeData;
} else if(name === 'responseCodes') {
const responseCodeData = {};
this.stats.responseCodes.forEach((stats, metric) =>{
statsHelpers.setStatsSummary(responseCodeData, metric, stats);
});
summary[name] = responseCodeData;
} else {
const data = {};
forEach(this.stats[name], (stats, metric) => {

View File

@ -9,8 +9,14 @@ mixin box(name, node, func)
mixin boxInfo(name, node, formatter)
-formatter = formatter || function(value) {return value}
-median= node.median
-max= node.max
-median=0
-max=0
-if(node && node.median !== 'undefined'){
-median=node.median
-}
-if(node && node.max !== 'undefined'){
-max=node.max
-}
.summarybox.info= name
.summarynumber #{formatter(median)} 
span.summarysmall (#{formatter(max)})
@ -37,6 +43,14 @@ block content
+boxInfo('Total requests', pagexray.summary.requests)
.one-third.column
+boxInfo('Image requests', pagexray.summary.contentTypes.image.requests)
.row
.one-third.column
+boxInfo('200 responses', pagexray.summary.responseCodes['200'])
.one-third.column
+boxInfo('301 responses', pagexray.summary.responseCodes['301'])
.one-third.column
+boxInfo('404 responses', pagexray.summary.responseCodes['404'])
if pagexray
.row