Plot app memory against the apps memory limit

This commit is contained in:
Johannes Zellner
2020-05-13 23:38:32 +02:00
parent 8b7c3308b3
commit 218ec9c678

View File

@@ -606,7 +606,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
var timePeriod = $scope.graphs.period * 60;
var timeBucketSize = $scope.graphs.period > 24 ? (6*60) : 5;
function fillGraph(canvasId, data, label, chartPropertyName) {
function fillGraph(canvasId, data, label, chartPropertyName, max) {
// translate the data from bytes to MB
var datapoints = data.datapoints.map(function (d) { return parseInt((d[0] / 1024 / 1024).toFixed(2)); });
var labels = datapoints.map(function (d, index) {
@@ -639,6 +639,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
yAxes: [{
ticks: {
min: 0,
max: max,
beginAtZero: true
}
}]
@@ -657,7 +658,9 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
Client.graphs([ memoryQuery, diskQuery ], '-' + timePeriod + 'min', {}, function (error, result) {
if (error) return console.error(error);
fillGraph('#graphsMemoryChart', result[0], 'Memory', 'memoryChart');
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');
});
}