This commit is contained in:
Zhe Wang 2023-10-17 11:19:25 -07:00
parent d24d9e6e21
commit 5f43fc91e7
3 changed files with 11 additions and 5 deletions

View File

@ -747,6 +747,7 @@ ACTOR Future<RangeResult> ddMetricsGetRangeActor(ReadYourWritesTransaction* ryw,
// Use json string encoded in utf-8 to encode the values, easy for adding more fields in the future
json_spirit::mObject statsObj;
statsObj["shard_bytes"] = ddMetricsRef.shardBytes;
statsObj["shard_bytes_per_ksecond"] = ddMetricsRef.shardBytesPerKSecond;
std::string statsString =
json_spirit::write_string(json_spirit::mValue(statsObj), json_spirit::Output_options::raw_utf8);
ValueRef bytes(result.arena(), statsString);

View File

@ -1333,16 +1333,19 @@ struct HealthMetrics {
struct DDMetricsRef {
int64_t shardBytes;
int64_t shardBytesPerKSecond;
KeyRef beginKey;
DDMetricsRef() : shardBytes(0) {}
DDMetricsRef(int64_t bytes, KeyRef begin) : shardBytes(bytes), beginKey(begin) {}
DDMetricsRef() : shardBytes(0), shardBytesPerKSecond(0) {}
DDMetricsRef(int64_t bytes, int64_t bytesPerKSecond, KeyRef begin)
: shardBytes(bytes), shardBytesPerKSecond(bytesPerKSecond), beginKey(begin) {}
DDMetricsRef(Arena& a, const DDMetricsRef& copyFrom)
: shardBytes(copyFrom.shardBytes), beginKey(a, copyFrom.beginKey) {}
: shardBytes(copyFrom.shardBytes), shardBytesPerKSecond(copyFrom.shardBytesPerKSecond),
beginKey(a, copyFrom.beginKey) {}
template <class Ar>
void serialize(Ar& ar) {
serializer(ar, shardBytes, beginKey);
serializer(ar, shardBytes, beginKey, shardBytesPerKSecond);
}
};

View File

@ -1437,7 +1437,9 @@ ACTOR Future<Void> fetchShardMetricsList_impl(DataDistributionTracker* self, Get
break;
}
result.push_back_deep(result.arena(),
DDMetricsRef(stats->get().get().metrics.bytes, KeyRef(t.begin().toString())));
DDMetricsRef(stats->get().get().metrics.bytes,
stats->get().get().metrics.bytesWrittenPerKSecond,
KeyRef(t.begin().toString())));
++shardNum;
if (shardNum >= req.shardLimit) {
break;