@@ -23,13 +23,138 @@ export const metrics = (state: RootState): MetricHash => {
23
23
if ( metricsPayload === null ) {
24
24
return { } ;
25
25
}
26
- return metricsPayload . data . reduce ( ( acc , curr ) => {
26
+
27
+ metricsPayload . data = [
28
+ {
29
+ source_type : 'OCP' ,
30
+ metric : 'cluster_core_cost_per_hour' ,
31
+ label_metric : 'Cluster' ,
32
+ label_measurement : 'Count' ,
33
+ label_measurement_unit : 'core-hour' ,
34
+ default_cost_type : 'Infrastructure' ,
35
+ } ,
36
+ {
37
+ source_type : 'OCP' ,
38
+ metric : 'vm_cost_per_month' ,
39
+ label_metric : 'Virtual Machine' ,
40
+ label_measurement : 'Count' ,
41
+ label_measurement_unit : 'vm-month' ,
42
+ default_cost_type : 'Infrastructure' ,
43
+ } ,
44
+ {
45
+ source_type : 'OpenShift Container Platform' ,
46
+ metric : 'cpu_core_usage_per_hour' ,
47
+ label_metric : 'CPU' ,
48
+ label_measurement : 'Usage' ,
49
+ label_measurement_unit : 'core-hours' ,
50
+ default_cost_type : 'Supplementary' ,
51
+ } ,
52
+ {
53
+ source_type : 'OpenShift Container Platform' ,
54
+ metric : 'cpu_core_request_per_hour' ,
55
+ label_metric : 'CPU' ,
56
+ label_measurement : 'Request' ,
57
+ label_measurement_unit : 'core-hours' ,
58
+ default_cost_type : 'Supplementary' ,
59
+ } ,
60
+ {
61
+ source_type : 'OpenShift Container Platform' ,
62
+ metric : 'cpu_core_effective_usage_per_hour' ,
63
+ label_metric : 'CPU' ,
64
+ label_measurement : 'Effective-usage' ,
65
+ label_measurement_unit : 'core-hours' ,
66
+ default_cost_type : 'Supplementary' ,
67
+ } ,
68
+ {
69
+ source_type : 'OpenShift Container Platform' ,
70
+ metric : 'memory_gb_usage_per_hour' ,
71
+ label_metric : 'Memory' ,
72
+ label_measurement : 'Usage' ,
73
+ label_measurement_unit : 'GiB-hours' ,
74
+ default_cost_type : 'Supplementary' ,
75
+ } ,
76
+ {
77
+ source_type : 'OpenShift Container Platform' ,
78
+ metric : 'memory_gb_request_per_hour' ,
79
+ label_metric : 'Memory' ,
80
+ label_measurement : 'Request' ,
81
+ label_measurement_unit : 'GiB-hours' ,
82
+ default_cost_type : 'Supplementary' ,
83
+ } ,
84
+ {
85
+ source_type : 'OpenShift Container Platform' ,
86
+ metric : 'memory_gb_effective_usage_per_hour' ,
87
+ label_metric : 'Memory' ,
88
+ label_measurement : 'Effective-usage' ,
89
+ label_measurement_unit : 'GiB-hours' ,
90
+ default_cost_type : 'Supplementary' ,
91
+ } ,
92
+ {
93
+ source_type : 'OpenShift Container Platform' ,
94
+ metric : 'storage_gb_usage_per_month' ,
95
+ label_metric : 'Storage' ,
96
+ label_measurement : 'Usage' ,
97
+ label_measurement_unit : 'GiB-month' ,
98
+ default_cost_type : 'Supplementary' ,
99
+ } ,
100
+ {
101
+ source_type : 'OpenShift Container Platform' ,
102
+ metric : 'storage_gb_request_per_month' ,
103
+ label_metric : 'Storage' ,
104
+ label_measurement : 'Request' ,
105
+ label_measurement_unit : 'GiB-month' ,
106
+ default_cost_type : 'Supplementary' ,
107
+ } ,
108
+ {
109
+ source_type : 'OpenShift Container Platform' ,
110
+ metric : 'node_core_cost_per_hour' ,
111
+ label_metric : 'Node' ,
112
+ label_measurement : 'Count' ,
113
+ label_measurement_unit : 'core-hour' ,
114
+ default_cost_type : 'Infrastructure' ,
115
+ } ,
116
+ {
117
+ source_type : 'OpenShift Container Platform' ,
118
+ metric : 'node_cost_per_month' ,
119
+ label_metric : 'Node' ,
120
+ label_measurement : 'Count' ,
121
+ label_measurement_unit : 'node-month' ,
122
+ default_cost_type : 'Infrastructure' ,
123
+ } ,
124
+ {
125
+ source_type : 'OpenShift Container Platform' ,
126
+ metric : 'node_core_cost_per_month' ,
127
+ label_metric : 'Node' ,
128
+ label_measurement : 'Count' ,
129
+ label_measurement_unit : 'core-month' ,
130
+ default_cost_type : 'Infrastructure' ,
131
+ } ,
132
+ {
133
+ source_type : 'OpenShift Container Platform' ,
134
+ metric : 'cluster_cost_per_month' ,
135
+ label_metric : 'Cluster' ,
136
+ label_measurement : 'Count' ,
137
+ label_measurement_unit : 'cluster-month' ,
138
+ default_cost_type : 'Infrastructure' ,
139
+ } ,
140
+ {
141
+ source_type : 'OpenShift Container Platform' ,
142
+ metric : 'pvc_cost_per_month' ,
143
+ label_metric : 'Persistent volume claims' ,
144
+ label_measurement : 'Count' ,
145
+ label_measurement_unit : 'pvc-month' ,
146
+ default_cost_type : 'Infrastructure' ,
147
+ } ,
148
+ ] as any ;
149
+
150
+ const test = metricsPayload . data . reduce ( ( acc , curr ) => {
27
151
const prev = acc [ curr . label_metric ] ? { ...acc [ curr . label_metric ] } : { } ;
28
152
return {
29
153
...acc ,
30
154
[ curr . label_metric ] : { ...prev , [ curr . metric ] : curr } ,
31
155
} ;
32
156
} , { } ) ;
157
+ return test ;
33
158
} ;
34
159
35
160
export const maxRate = ( state : RootState ) : number => {
0 commit comments