horizon: sort metrics name, rename cpu average to all cpus

This commit is contained in:
Florent BEAUCHAMP
2015-09-24 21:02:34 +02:00
parent 4059a4fd9a
commit 5da31691a9

View File

@@ -79,7 +79,9 @@ export default angular.module('xoWebApp.services', [
}
if (stat[0] instanceof Array) {
// init arrays
metrics[statKey + '_average'] = []
if (statKey === 'cpus') {
metrics['All CPUs'] = []
}
for (statCounter = 0; statCounter < stat.length; statCounter++) {
metricName = computeMetricFullname(statKey, statCounter)
if (statKey !== 'cpus') { // hosts can have 32+ cpu, don't want the detail
@@ -101,11 +103,14 @@ export default angular.module('xoWebApp.services', [
})
}
}
metrics[statKey + '_average'].push({
date: d,
value: sum / stat.length,
textValue: computeTextValue(object, statKey, sum / stat.length)
})
if (statKey === 'cpus') {
metrics['All CPUs'].push({
date: d,
value: sum / stat.length,
textValue: computeTextValue(object, statKey, sum / stat.length)
})
}
}
} else {
metricName = computeMetricFullname(statKey, '')
@@ -127,7 +132,7 @@ export default angular.module('xoWebApp.services', [
agglomeratedStats.details[object.id] = metrics
})
// agglomerate objects stats
agglomeratedStats.keys = statKeys
agglomeratedStats.keys = statKeys.sort()
/*
foreach(statKeys, function (statKey) {
let dateCounter, sum, d