提交 21dfb948 编写于 作者: Z ZhaoMing

Add dbimpl_writeimpl_batch_size

上级 fd5ba845
......@@ -176,6 +176,7 @@ static std::string seekforprev_latency_metric_name =
static std::string prev_latency_metric_name = "dbiter_prev_latency";
static std::string write_throughput_metric_name = "dbimpl_writeimpl_throughput";
static std::string write_batch_size_metric_name = "dbimpl_writeimpl_batch_size";
DBImpl::DBImpl(const DBOptions& options, const std::string& dbname,
const bool seq_per_batch, const bool batch_per_txn)
......@@ -325,6 +326,9 @@ DBImpl::DBImpl(const DBOptions& options, const std::string& dbname,
immutable_db_options_.info_log.get())),
write_throughput_reporter_(*metrics_reporter_factory_->BuildCountReporter(
write_throughput_metric_name, bytedance_tags_,
immutable_db_options_.info_log.get())),
write_batch_size_reporter_(*metrics_reporter_factory_->BuildHistReporter(
write_batch_size_metric_name, bytedance_tags_,
immutable_db_options_.info_log.get())) {
// !batch_per_trx_ implies seq_per_batch_ because it is only unset for
// WriteUnprepared, which should use seq_per_batch_.
......
......@@ -675,6 +675,7 @@ class DBImpl : public DB {
LatencyReporter prev_latency_reporter() { return prev_latency_reporter_; }
using ThroughputReporter = CountReporterHandle&;
using DistributionReporter = HistReporterHandle&;
std::unordered_map<std::string, RecoveredTransaction*>
recovered_transactions() {
......@@ -1824,6 +1825,7 @@ class DBImpl : public DB {
LatencyReporter prev_latency_reporter_;
ThroughputReporter write_throughput_reporter_;
DistributionReporter write_batch_size_reporter_
};
extern Options SanitizeOptions(const std::string& db, const Options& src);
......
......@@ -79,6 +79,7 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
LatencyHistGuard guard(&write_latency_reporter_);
write_qps_reporter_.AddCount(WriteBatchInternal::Count(my_batch));
write_throughput_reporter_.AddCount(WriteBatchInternal::ByteSize(my_batch));
write_batch_size_reporter_.AddRecord(WriteBatchInternal::ByteSize(my_batch));
assert(!seq_per_batch_ || batch_cnt != 0);
if (my_batch == nullptr) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册