Use explicit app graphs api
This commit is contained in:
@@ -799,9 +799,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
},
|
||||
|
||||
show: function () {
|
||||
// both in minutes
|
||||
// in minutes
|
||||
var timePeriod = $scope.graphs.period * 60;
|
||||
var timeBucketSize = $scope.graphs.period > 24 ? (6*60) : 5;
|
||||
|
||||
function fillGraph(canvasId, data, label, chartPropertyName, max) {
|
||||
if (!data) return; // no data available yet
|
||||
@@ -871,16 +870,13 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
$scope.graphs[chartPropertyName] = new Chart(ctx, { type: 'line', data: graphData, options: options });
|
||||
}
|
||||
|
||||
var memoryQuery = 'summarize(sum(collectd.localhost.table-' + appId + '-memory.gauge-rss, collectd.localhost.table-' + appId + '-memory.gauge-swap), "' + timeBucketSize + 'min", "avg")';
|
||||
var diskQuery = 'summarize(collectd.localhost.du-' + appId + '.capacity-usage, "' + timeBucketSize + 'min", "avg")';
|
||||
|
||||
Client.graphs([ memoryQuery, diskQuery ], '-' + timePeriod + 'min', { appId: appId }, function (error, result) {
|
||||
Client.getAppGraphs(appId, timePeriod, function (error, result) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
var currentMemoryLimit = $scope.app.memoryLimit || $scope.app.manifest.memoryLimit || (256 * 1024 * 1024);
|
||||
|
||||
fillGraph('#graphsMemoryChart', result[0], 'Memory', 'memoryChart', currentMemoryLimit / 1024 / 1024);
|
||||
fillGraph('#graphsDiskChart', result[1], 'Disk', 'diskChart', 1024 / 1024);
|
||||
fillGraph('#graphsMemoryChart', result.memory, 'Memory', 'memoryChart', currentMemoryLimit / 1024 / 1024);
|
||||
fillGraph('#graphsDiskChart', result.disk, 'Disk', 'diskChart', 1024 / 1024);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user