Skip to content

Commit 7d46770

Browse files
committed
Merged docker-stats feature into latest UI revamp.
1 parent 52722d5 commit 7d46770

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

app/charts/docker-stats-chart.jsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ const DockerStatsChart = (props) => {
99
// const healthData = useContext(HealthContext).detailData[length - 1]; // <== only used if only getting the last data pt.
1010
const healthData = useContext(HealthContext).detailData;
1111

12-
console.log('healthData (in docker-stats-chart):', healthData);
13-
console.log('props.service:', props.service);
12+
// console.log('healthData (in docker-stats-chart):', healthData);
1413

1514
// Declare a dockerStats obj to store extracted Docker stats.
1615
let dockerStats = {};
@@ -24,33 +23,35 @@ const DockerStatsChart = (props) => {
2423
if (healthData[i].currentMicroservice === props.service) {
2524
// Extract Docker-related data (MongoDB) and save to dockerStats obj.
2625
dockerStats = {
27-
'Containerized service': healthData.currentMicroservice,
28-
'Container ID': healthData.containerId.slice(0, 7) + '[...]',
29-
'CPU usage %': parseFloat(healthData.containerCpuPercent).toFixed(2) + '%',
30-
'Mem usage %': parseFloat(healthData.containerMemPercent).toFixed(2) + '%',
31-
'Mem limit (Mb)': parseFloat(healthData.containerMemLimit / 1000000).toFixed(2),
32-
'Mem usage (Mb)': parseFloat(healthData.containerMemUsage / 1000000).toFixed(2),
33-
'Network I/O - Received (Kb)': parseFloat(healthData.networkReceived / 1000).toFixed(2),
34-
'Network I/O - Sent (Kb)': parseFloat(healthData.networkSent / 1000).toFixed(2),
35-
'Process count': healthData.containerProcessCount,
36-
'Restart count': healthData.containerRestartCount,
26+
'Containerized service': healthData[i].currentMicroservice,
27+
'Container ID': healthData[i].containerId.slice(0, 7) + '[...]',
28+
'CPU usage %': parseFloat(healthData[i].containerCpuPercent).toFixed(2) + '%',
29+
'Mem usage %': parseFloat(healthData[i].containerMemPercent).toFixed(2) + '%',
30+
'Mem limit (Mb)': parseFloat(healthData[i].containerMemLimit / 1000000).toFixed(2),
31+
'Mem usage (Mb)': parseFloat(healthData[i].containerMemUsage / 1000000).toFixed(2),
32+
'Network I/O - Received (Kb)': parseFloat(healthData[i].networkReceived / 1000).toFixed(2),
33+
'Network I/O - Sent (Kb)': parseFloat(healthData[i].networkSent / 1000).toFixed(2),
34+
'Process count': healthData[i].containerProcessCount,
35+
'Restart count': healthData[i].containerRestartCount,
3736
};
37+
break;
3838
}
3939

4040
// If postgreSQL:
4141
if (healthData[i].currentmicroservice === props.service) {
4242
dockerStats = {
43-
'Containerized service': healthData.currentmicroservice,
44-
'Container ID': healthData.containerid.slice(0, 7) + '[...]',
45-
'CPU usage %': parseFloat(healthData.containercpupercent).toFixed(2) + '%',
46-
'Mem usage %': parseFloat(healthData.containermempercent).toFixed(2) + '%',
47-
'Mem limit (Mb)': parseFloat(healthData.containermemlimit / 1000000).toFixed(2),
48-
'Mem usage (Mb)': parseFloat(healthData.containermemusage / 1000000).toFixed(2),
49-
'Network I/O - Received (Kb)': parseFloat(healthData.networkreceived / 1000).toFixed(2),
50-
'Network I/O - Sent (Kb)': parseFloat(healthData.networksent / 1000).toFixed(2),
51-
'Process count': healthData.containerprocesscount,
52-
'Restart count': healthData.containerrestartcount,
43+
'Containerized service': healthData[i].currentmicroservice,
44+
'Container ID': healthData[i].containerid.slice(0, 7) + '[...]',
45+
'CPU usage %': parseFloat(healthData[i].containercpupercent).toFixed(2) + '%',
46+
'Mem usage %': parseFloat(healthData[i].containermempercent).toFixed(2) + '%',
47+
'Mem limit (Mb)': parseFloat(healthData[i].containermemlimit / 1000000).toFixed(2),
48+
'Mem usage (Mb)': parseFloat(healthData[i].containermemusage / 1000000).toFixed(2),
49+
'Network I/O - Received (Kb)': parseFloat(healthData[i].networkreceived / 1000).toFixed(2),
50+
'Network I/O - Sent (Kb)': parseFloat(healthData[i].networksent / 1000).toFixed(2),
51+
'Process count': healthData[i].containerprocesscount,
52+
'Restart count': healthData[i].containerrestartcount,
5353
};
54+
break;
5455
}
5556
}
5657

user/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"setupRequired":false,"services":[["docker-mongo","MongoDB","mongodb+srv://alon:testing123@cluster0-phsei.mongodb.net/test?retryWrites=true&w=majority"]],"splash":false}
1+
{"setupRequired":false,"services":[["docker-mongo","MongoDB","mongodb+srv://alon:testing123@cluster0-phsei.mongodb.net/test?retryWrites=true&w=majority"]],"splash":true}

0 commit comments

Comments
 (0)