mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 14:59:41 +02:00
Bump stats endpoint timeout to 5 seconds, retry on error.
This commit is contained in:
parent
316017c516
commit
a198382c06
2 changed files with 3 additions and 6 deletions
|
@ -110,9 +110,10 @@ angular.module('stats', [])
|
||||||
updateCpuChart(d);
|
updateCpuChart(d);
|
||||||
updateMemoryChart(d);
|
updateMemoryChart(d);
|
||||||
updateNetworkChart(d);
|
updateNetworkChart(d);
|
||||||
timeout = $timeout(updateStats, 2000);
|
timeout = $timeout(updateStats, 5000);
|
||||||
}, function () {
|
}, function () {
|
||||||
Messages.error('Unable to retrieve stats', 'Is this container running?');
|
Messages.error('Unable to retrieve stats', 'Is this container running?');
|
||||||
|
timeout = $timeout(updateStats, 5000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +125,11 @@ angular.module('stats', [])
|
||||||
updateStats();
|
updateStats();
|
||||||
|
|
||||||
function updateCpuChart(data) {
|
function updateCpuChart(data) {
|
||||||
console.log('updateCpuChart', data);
|
|
||||||
cpuChart.addData([calculateCPUPercent(data)], new Date(data.read).toLocaleTimeString());
|
cpuChart.addData([calculateCPUPercent(data)], new Date(data.read).toLocaleTimeString());
|
||||||
cpuChart.removeData();
|
cpuChart.removeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateMemoryChart(data) {
|
function updateMemoryChart(data) {
|
||||||
console.log('updateMemoryChart', data);
|
|
||||||
memoryChart.addData([data.memory_stats.usage], new Date(data.read).toLocaleTimeString());
|
memoryChart.addData([data.memory_stats.usage], new Date(data.read).toLocaleTimeString());
|
||||||
memoryChart.removeData();
|
memoryChart.removeData();
|
||||||
}
|
}
|
||||||
|
@ -152,7 +151,6 @@ angular.module('stats', [])
|
||||||
}
|
}
|
||||||
lastRxBytes = data.network.rx_bytes;
|
lastRxBytes = data.network.rx_bytes;
|
||||||
lastTxBytes = data.network.tx_bytes;
|
lastTxBytes = data.network.tx_bytes;
|
||||||
console.log('updateNetworkChart', data);
|
|
||||||
networkChart.addData([rxBytes, txBytes], new Date(data.read).toLocaleTimeString());
|
networkChart.addData([rxBytes, txBytes], new Date(data.read).toLocaleTimeString());
|
||||||
networkChart.removeData();
|
networkChart.removeData();
|
||||||
}
|
}
|
||||||
|
@ -170,7 +168,6 @@ angular.module('stats', [])
|
||||||
var systemDelta = curCpu.system_cpu_usage - prevCpu.system_cpu_usage;
|
var systemDelta = curCpu.system_cpu_usage - prevCpu.system_cpu_usage;
|
||||||
|
|
||||||
if (systemDelta > 0.0 && cpuDelta > 0.0) {
|
if (systemDelta > 0.0 && cpuDelta > 0.0) {
|
||||||
//console.log('size thing:', curCpu.cpu_usage.percpu_usage);
|
|
||||||
cpuPercent = (cpuDelta / systemDelta) * curCpu.cpu_usage.percpu_usage.length * 100.0;
|
cpuPercent = (cpuDelta / systemDelta) * curCpu.cpu_usage.percpu_usage.length * 100.0;
|
||||||
}
|
}
|
||||||
return cpuPercent;
|
return cpuPercent;
|
||||||
|
|
|
@ -18,7 +18,7 @@ angular.module('dockerui.services', ['ngResource'])
|
||||||
create: {method: 'POST', params: {action: 'create'}},
|
create: {method: 'POST', params: {action: 'create'}},
|
||||||
remove: {method: 'DELETE', params: {id: '@id', v: 0}},
|
remove: {method: 'DELETE', params: {id: '@id', v: 0}},
|
||||||
rename: {method: 'POST', params: {id: '@id', action: 'rename'}, isArray: false},
|
rename: {method: 'POST', params: {id: '@id', action: 'rename'}, isArray: false},
|
||||||
stats: {method: 'GET', params: {id: '@id', stream: false, action: 'stats'}, timeout: 2000}
|
stats: {method: 'GET', params: {id: '@id', stream: false, action: 'stats'}, timeout: 5000}
|
||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
.factory('ContainerCommit', ['$resource', '$http', 'Settings', function ContainerCommitFactory($resource, $http, Settings) {
|
.factory('ContainerCommit', ['$resource', '$http', 'Settings', function ContainerCommitFactory($resource, $http, Settings) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue