Add apps with more than 1gb memory to system graph
This commit is contained in:
@@ -122,7 +122,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
datasets.push({
|
||||
label: content.label,
|
||||
backgroundColor: backgroundColors[index],
|
||||
borderColor: borderColors[index],
|
||||
borderColor: borderColors[index%2], // FIXME give real distinct colors
|
||||
borderWidth: 1,
|
||||
radius: 0,
|
||||
data: datapoints,
|
||||
@@ -169,8 +169,19 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
$scope[chartPropertyName] = new Chart(ctx, { type: 'line', data: graphData, options: options });
|
||||
}
|
||||
|
||||
var threshold = 1024 * 1024 * 1024;
|
||||
var appsWithHighMemory = Object.keys(result.apps).map(function (appId) {
|
||||
result.apps[appId].id = appId;
|
||||
return result.apps[appId];
|
||||
}).filter(function (app) {
|
||||
if (!app.memory) return false; // not sure why we get empty objects
|
||||
return app.memory.datapoints.some(function (d) { return d[0] > threshold; });
|
||||
}).map(function (app) {
|
||||
return { data: app.memory, label: app.id };
|
||||
});
|
||||
|
||||
fillGraph('#graphsCPUChart', [{ data: result.cpu, label: 'CPU' }], 'cpuChart', 100, 1);
|
||||
fillGraph('#graphsSystemMemoryChart', [{ data: result.memory, label: 'Memory' }], 'memoryChart', 1024 * 1024, Number.parseInt($scope.memory.memory / 1024 / 1024));
|
||||
fillGraph('#graphsSystemMemoryChart', [{ data: result.memory, label: 'Memory' }].concat(appsWithHighMemory), 'memoryChart', 1024 * 1024, Number.parseInt($scope.memory.memory / 1024 / 1024));
|
||||
|
||||
$scope.busy = false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user