This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e010bbee7 [improvement](profile) add profile counter 'BytesSent' for 
VDataBufferSender (#19826)
3e010bbee7 is described below

commit 3e010bbee749f8e3f1d087c3c6d2eff1147a8022
Author: luozenglin <[email protected]>
AuthorDate: Fri May 19 08:46:50 2023 +0800

    [improvement](profile) add profile counter 'BytesSent' for 
VDataBufferSender (#19826)
---
 be/src/runtime/plan_fragment_executor.cpp | 2 +-
 be/src/vec/sink/vmysql_result_writer.cpp  | 7 +++++++
 be/src/vec/sink/vmysql_result_writer.h    | 4 ++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/be/src/runtime/plan_fragment_executor.cpp 
b/be/src/runtime/plan_fragment_executor.cpp
index ed8aa34524..bd99a9a2e3 100644
--- a/be/src/runtime/plan_fragment_executor.cpp
+++ b/be/src/runtime/plan_fragment_executor.cpp
@@ -225,7 +225,7 @@ Status PlanFragmentExecutor::prepare(const 
TExecPlanFragmentParams& request,
 
     // set up profile counters
     profile()->add_child(_plan->runtime_profile(), true, nullptr);
-    profile()->add_info_string("DoriBeVersion", 
version::doris_build_short_hash());
+    profile()->add_info_string("DorisBeVersion", 
version::doris_build_short_hash());
     _rows_produced_counter = ADD_COUNTER(profile(), "RowsProduced", 
TUnit::UNIT);
     _blocks_produced_counter = ADD_COUNTER(profile(), "BlocksProduced", 
TUnit::UNIT);
     _fragment_cpu_timer = ADD_TIMER(profile(), "FragmentCpuTime");
diff --git a/be/src/vec/sink/vmysql_result_writer.cpp 
b/be/src/vec/sink/vmysql_result_writer.cpp
index ce2498009e..c372dc4570 100644
--- a/be/src/vec/sink/vmysql_result_writer.cpp
+++ b/be/src/vec/sink/vmysql_result_writer.cpp
@@ -99,6 +99,7 @@ void VMysqlResultWriter<is_binary_format>::_init_profile() {
     _convert_tuple_timer = ADD_CHILD_TIMER(_parent_profile, 
"TupleConvertTime", "AppendBatchTime");
     _result_send_timer = ADD_CHILD_TIMER(_parent_profile, "ResultSendTime", 
"AppendBatchTime");
     _sent_rows_counter = ADD_COUNTER(_parent_profile, "NumSentRows", 
TUnit::UNIT);
+    _bytes_sent_counter = ADD_COUNTER(_parent_profile, "BytesSent", 
TUnit::BYTES);
 }
 
 template <bool is_binary_format>
@@ -894,10 +895,12 @@ Status 
VMysqlResultWriter<is_binary_format>::append_block(Block& input_block) {
         }
     }
 
+    uint64_t bytes_sent = 0;
     // copy MysqlRowBuffer to Thrift
     result->result_batch.rows.resize(num_rows);
     for (int i = 0; i < num_rows; ++i) {
         result->result_batch.rows[i].append(rows_buffer[i].buf(), 
rows_buffer[i].length());
+        bytes_sent += rows_buffer[i].length();
     }
 
     if (status) {
@@ -912,6 +915,9 @@ Status 
VMysqlResultWriter<is_binary_format>::append_block(Block& input_block) {
         }
         if (status.ok()) {
             _written_rows += num_rows;
+            if (!_is_dry_run) {
+                _bytes_sent += bytes_sent;
+            }
         } else {
             LOG(WARNING) << "append result batch to sink failed.";
         }
@@ -928,6 +934,7 @@ bool VMysqlResultWriter<is_binary_format>::can_sink() {
 template <bool is_binary_format>
 Status VMysqlResultWriter<is_binary_format>::close() {
     COUNTER_SET(_sent_rows_counter, _written_rows);
+    COUNTER_UPDATE(_bytes_sent_counter, _bytes_sent);
     return Status::OK();
 }
 
diff --git a/be/src/vec/sink/vmysql_result_writer.h 
b/be/src/vec/sink/vmysql_result_writer.h
index 19c2838c60..9626edfcd2 100644
--- a/be/src/vec/sink/vmysql_result_writer.h
+++ b/be/src/vec/sink/vmysql_result_writer.h
@@ -80,10 +80,14 @@ private:
     RuntimeProfile::Counter* _result_send_timer = nullptr;
     // number of sent rows
     RuntimeProfile::Counter* _sent_rows_counter = nullptr;
+    // size of sent data
+    RuntimeProfile::Counter* _bytes_sent_counter = nullptr;
     // for synchronized results
     ResultList _results;
     // If true, no block will be sent
     bool _is_dry_run = false;
+
+    uint64_t _bytes_sent = 0;
 };
 } // namespace vectorized
 } // namespace doris


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to