[BE] Add scanner/etl thread pool queue size metric. (#5619)

* [BE] Add scanner/etl thread pool queue size metric.

* Fix compilation problem.
This commit is contained in:
曹建华
2021-04-20 09:14:57 +08:00
committed by GitHub
parent 7445051174
commit a2e83e65d2
3 changed files with 26 additions and 0 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;