You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ya...@apache.org on 2021/04/20 01:15:14 UTC

[incubator-doris] branch master updated: [BE] Add scanner/etl thread pool queue size metric. (#5619)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a2e83e6  [BE] Add scanner/etl thread pool queue size metric. (#5619)
a2e83e6 is described below

commit a2e83e65d2e8aad604c35fe492f5bdd92650cbd7
Author: 曹建华 <ca...@bytedance.com>
AuthorDate: Tue Apr 20 09:14:57 2021 +0800

    [BE] Add scanner/etl thread pool queue size metric. (#5619)
    
    * [BE] Add scanner/etl thread pool queue size metric.
    
    * Fix compilation problem.
---
 be/src/runtime/exec_env.h        |  3 +++
 be/src/runtime/exec_env_init.cpp | 20 ++++++++++++++++++++
 be/src/util/doris_metrics.h      |  3 +++
 3 files changed, 26 insertions(+)

diff --git a/be/src/runtime/exec_env.h b/be/src/runtime/exec_env.h
index 7a5460b..5968a8e 100644
--- a/be/src/runtime/exec_env.h
+++ b/be/src/runtime/exec_env.h
@@ -148,6 +148,9 @@ private:
     /// Initialise 'buffer_pool_' and 'buffer_reservation_' with given capacity.
     void _init_buffer_pool(int64_t min_page_len, int64_t capacity, int64_t clean_pages_limit);
 
+    void _register_metrics();
+    void _deregister_metrics();
+
 private:
     bool _is_init;
     std::vector<StorePath> _store_paths;
diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index 4fbf26a..c9b9ad1 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -64,6 +64,9 @@
 
 namespace doris {
 
+DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(scanner_thread_pool_queue_size, MetricUnit::NOUNIT);
+DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(etl_thread_pool_queue_size, MetricUnit::NOUNIT);
+
 Status ExecEnv::init(ExecEnv* env, const std::vector<StorePath>& store_paths) {
     return env->_init(store_paths);
 }
@@ -125,6 +128,7 @@ Status ExecEnv::_init(const std::vector<StorePath>& store_paths) {
 
     RETURN_IF_ERROR(_load_channel_mgr->init(_mem_tracker->limit()));
     _heartbeat_flags = new HeartbeatFlags();
+    _register_metrics();
     _is_init = true;
     return Status::OK();
 }
@@ -208,11 +212,27 @@ void ExecEnv::_init_buffer_pool(int64_t min_page_size, int64_t capacity,
     _buffer_reservation->InitRootTracker(nullptr, capacity);
 }
 
+void ExecEnv::_register_metrics() {
+    REGISTER_HOOK_METRIC(scanner_thread_pool_queue_size, [this]() {
+        return _thread_pool->get_queue_size();
+    });
+
+    REGISTER_HOOK_METRIC(etl_thread_pool_queue_size, [this]() {
+        return _etl_thread_pool->get_queue_size();
+    });
+}
+
+void ExecEnv::_deregister_metrics() {
+    DEREGISTER_HOOK_METRIC(scanner_thread_pool_queue_size);
+    DEREGISTER_HOOK_METRIC(etl_thread_pool_queue_size);
+}
+
 void ExecEnv::_destroy() {
     //Only destroy once after init
     if (!_is_init) {
         return;
     }
+    _deregister_metrics();
     SAFE_DELETE(_brpc_stub_cache);
     SAFE_DELETE(_load_stream_mgr);
     SAFE_DELETE(_load_channel_mgr);
diff --git a/be/src/util/doris_metrics.h b/be/src/util/doris_metrics.h
index 3a67bbc..7e548c8 100644
--- a/be/src/util/doris_metrics.h
+++ b/be/src/util/doris_metrics.h
@@ -180,6 +180,9 @@ public:
     UIntGauge* query_cache_sql_total_count;
     UIntGauge* query_cache_partition_total_count;
 
+    UIntGauge* scanner_thread_pool_queue_size;
+    UIntGauge* etl_thread_pool_queue_size;
+
     static DorisMetrics* instance() {
         static DorisMetrics instance;
         return &instance;

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org