1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-09 15:55:23 +02:00

feat(container-stats): introduce container block I/O stats (#5017)

* feat(container-stats):introduce container block io stats

* Change charts to 2x2 view

* fix(container-stats): handle missing io stats by detecting stats based on op codes

Co-authored-by: DarkAEther <30438425+DarkAEther@users.noreply.github.com>
This commit is contained in:
zees-dev 2021-06-14 15:57:00 +12:00 committed by GitHub
parent 49bd139466
commit 6e9f472723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 105 additions and 8 deletions

View file

@ -98,10 +98,48 @@ angular.module('portainer.app').factory('ChartService', [
});
}
function CreateIOChart(context, tooltipCallback, scalesCallback) {
return new Chart(context, {
type: 'line',
data: {
labels: [],
datasets: [
{
label: 'Read (Aggregate)',
data: [],
fill: true,
backgroundColor: 'rgba(151,187,205,0.4)',
borderColor: 'rgba(151,187,205,0.6)',
pointBackgroundColor: 'rgba(151,187,205,1)',
pointBorderColor: 'rgba(151,187,205,1)',
pointRadius: 2,
borderWidth: 2,
},
{
label: 'Write (Aggregate)',
data: [],
fill: true,
backgroundColor: 'rgba(255,180,174,0.4)',
borderColor: 'rgba(255,180,174,0.6)',
pointBackgroundColor: 'rgba(255,180,174,1)',
pointBorderColor: 'rgba(255,180,174,1)',
pointRadius: 2,
borderWidth: 2,
},
],
},
options: defaultChartOptions('nearest', tooltipCallback, scalesCallback, true),
});
}
service.CreateCPUChart = function (context) {
return CreateChart(context, 'CPU', percentageBasedTooltipLabel, percentageBasedAxisLabel);
};
service.CreateIOChart = function (context) {
return CreateIOChart(context, byteBasedTooltipLabel, byteBasedAxisLabel);
};
service.CreateMemoryChart = function (context) {
return CreateMemoryChart(context, byteBasedTooltipLabel, byteBasedAxisLabel);
};
@ -176,6 +214,13 @@ angular.module('portainer.app').factory('ChartService', [
chart.update(0);
};
service.UpdateCPUChart = UpdateChart;
service.UpdateIOChart = function (label, read, write, chart) {
chart.data.labels.push(label);
chart.data.datasets[0].data.push(read);
chart.data.datasets[1].data.push(write);
LimitChartItems(chart);
chart.update(0);
};
service.UpdateNetworkChart = function (label, rx, tx, chart) {
chart.data.labels.push(label);