@@ -12,7 +12,7 @@ import { InlineLoading } from '../../Loading';
12
12
import { UtilizationBody } from '../../Dashboard/Utilization/UtilizationBody' ;
13
13
import { UtilizationItem } from '../../Dashboard/Utilization/UtilizationItem' ;
14
14
import { getCapacityStats , getUtilizationVectorStats } from '../../../selectors' ;
15
- import { formatBytes } from '../../../utils' ;
15
+ import { formatBytes , formatNetTraffic } from '../../../utils' ;
16
16
17
17
const getMemoryData = ( memoryUtilization , memoryTotal ) => {
18
18
let memoryStats ;
@@ -35,17 +35,40 @@ const getMemoryData = (memoryUtilization, memoryTotal) => {
35
35
} ;
36
36
} ;
37
37
38
+ const getThroughputData = iorw => {
39
+ let iorwStats ;
40
+ let maxValueConverted ;
41
+
42
+ const iorwRaw = getUtilizationVectorStats ( iorw ) ;
43
+ if ( iorwRaw ) {
44
+ const maxValue = Math . max ( ...iorwRaw ) ;
45
+ maxValueConverted = formatNetTraffic ( maxValue , undefined , 1 ) ;
46
+ iorwStats = iorwRaw . map ( rws => formatNetTraffic ( rws , maxValueConverted . unit , 1 ) . value ) ;
47
+ } else {
48
+ maxValueConverted = formatNetTraffic ( 0 ) ; // 0 Bps
49
+ iorwStats = null ;
50
+ }
51
+
52
+ return {
53
+ unit : maxValueConverted . unit ,
54
+ values : iorwStats ,
55
+ maxValue : maxValueConverted . value ,
56
+ } ;
57
+ } ;
58
+
38
59
export const Utilization = ( {
39
60
cpuUtilization,
40
61
memoryUtilization,
41
62
memoryTotal,
42
63
storageTotal,
43
64
storageUsed,
65
+ storageIORW,
44
66
LoadingComponent,
45
67
} ) => {
46
68
const cpuStats = getUtilizationVectorStats ( cpuUtilization ) ;
47
69
const memoryData = getMemoryData ( memoryUtilization , memoryTotal ) ;
48
70
const storageUsageData = getMemoryData ( storageUsed , storageTotal ) ;
71
+ const diskIORWData = getThroughputData ( storageIORW ) ;
49
72
50
73
return (
51
74
< DashboardCard >
@@ -72,6 +95,15 @@ export const Utilization = ({
72
95
LoadingComponent = { LoadingComponent }
73
96
isLoading = { ! ( memoryUtilization && memoryTotal ) }
74
97
/>
98
+ < UtilizationItem
99
+ unit = { diskIORWData . unit }
100
+ id = "diskIORW"
101
+ title = "Disk IO R/W"
102
+ data = { diskIORWData . values }
103
+ maxY = { diskIORWData . maxValue }
104
+ LoadingComponent = { LoadingComponent }
105
+ isLoading = { ! storageIORW }
106
+ />
75
107
< UtilizationItem
76
108
unit = { storageUsageData . unit }
77
109
id = "diskUsage"
@@ -93,6 +125,7 @@ Utilization.defaultProps = {
93
125
memoryTotal : null ,
94
126
storageTotal : null ,
95
127
storageUsed : null ,
128
+ storageIORW : null ,
96
129
LoadingComponent : InlineLoading ,
97
130
} ;
98
131
@@ -102,6 +135,7 @@ Utilization.propTypes = {
102
135
memoryTotal : PropTypes . object ,
103
136
storageTotal : PropTypes . object ,
104
137
storageUsed : PropTypes . object ,
138
+ storageIORW : PropTypes . object ,
105
139
LoadingComponent : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func ] ) ,
106
140
} ;
107
141
0 commit comments