@@ -44,6 +44,7 @@ void TopologyMetricService::UpdateTopologyMetrics() {
44
44
return cs.GetStatus () != ChunkServerStatus::RETIRED;
45
45
});
46
46
47
+ std::vector<CopysetStat> copysetStatsCs, copysetStatsCluster;
47
48
for (auto csId : chunkservers) {
48
49
auto it = gChunkServerMetrics .find (csId);
49
50
if (it == gChunkServerMetrics .end ()) {
@@ -84,6 +85,11 @@ void TopologyMetricService::UpdateTopologyMetrics() {
84
85
csStat.chunkSizeLeftBytes +
85
86
csStat.chunkSizeTrashedBytes );
86
87
}
88
+
89
+ copysetStatsCs = csStat.copysetStats ;
90
+ copysetStatsCluster.insert (copysetStatsCluster.end (),
91
+ copysetStatsCs.begin (), copysetStatsCs.end ());
92
+ copysetStatsCs.clear ();
87
93
}
88
94
89
95
// process logical pool
@@ -209,7 +215,36 @@ void TopologyMetricService::UpdateTopologyMetrics() {
209
215
it->second ->logicalCapacity .set_value (
210
216
totalChunkSizeBytes / pool.GetReplicaNum ());
211
217
}
218
+
219
+ uint64_t readRate = 0 , writeRate = 0 ,
220
+ readIOPS = 0 , writeIOPS = 0 ;
221
+ for (auto iterCsStat : copysetStatsCluster) {
222
+ if (iterCsStat.logicalPoolId == pid) {
223
+ readRate += iterCsStat.readRate ;
224
+ writeRate += iterCsStat.writeRate ;
225
+ readIOPS += iterCsStat.readIOPS ;
226
+ writeIOPS += iterCsStat.writeIOPS ;
227
+ }
228
+ DVLOG (6 ) << " copyset Metrics, csid is: "
229
+ << iterCsStat.copysetId << " , write iops: "
230
+ << iterCsStat.writeIOPS << " , write bps: "
231
+ << iterCsStat.writeRate << " , read bps: "
232
+ << iterCsStat.readRate << " , read iops: "
233
+ << iterCsStat.readIOPS ;
234
+ }
235
+ it->second ->writeIOPS .set_value (writeIOPS);
236
+ it->second ->writeRate .set_value (writeRate);
237
+ it->second ->readRate .set_value (readRate);
238
+ it->second ->readIOPS .set_value (readIOPS);
239
+
240
+ DVLOG (6 ) << " pool metrics, pid is: "
241
+ << pid << " , write iops: "
242
+ << writeIOPS << " , write bps: "
243
+ << writeRate << " , read bps: "
244
+ << readRate << " , read iops: "
245
+ << readIOPS;
212
246
}
247
+
213
248
// remove logical pool metrics that no longer exist
214
249
for (auto iy = gLogicalPoolMetrics .begin ();
215
250
iy != gLogicalPoolMetrics .end ();) {
0 commit comments