diff --git a/be/src/http/ev_http_server.cpp b/be/src/http/ev_http_server.cpp index 3e59e567ef469e..e57d49d11f8065 100644 --- a/be/src/http/ev_http_server.cpp +++ b/be/src/http/ev_http_server.cpp @@ -92,7 +92,8 @@ EvHttpServer::~EvHttpServer() { void EvHttpServer::start() { // bind to - CHECK(_bind().ok()); + auto s = _bind(); + CHECK(s.ok()) << s.to_string(); ThreadPoolBuilder("EvHttpServer") .set_min_threads(_num_workers) .set_max_threads(_num_workers) diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index 489400540d0cae..c2932e3aac5916 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -53,6 +53,7 @@ namespace doris { DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(plan_fragment_count, MetricUnit::NOUNIT); +DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(timeout_canceled_fragment_count, MetricUnit::NOUNIT); std::string to_load_error_http_path(const std::string& file_name) { if (file_name.empty()) { @@ -381,16 +382,19 @@ FragmentMgr::FragmentMgr(ExecEnv* exec_env) : _exec_env(exec_env), _fragment_map(), _stop_background_threads_latch(1) { + _entity = DorisMetrics::instance()->metric_registry()->register_entity("FragmentMgr"); + INT_UGAUGE_METRIC_REGISTER(_entity, timeout_canceled_fragment_count); + REGISTER_HOOK_METRIC(plan_fragment_count, [this]() { + std::lock_guard lock(_lock); + return _fragment_map.size(); + }); + CHECK(Thread::create("FragmentMgr", "cancel_timeout_plan_fragment", [this]() { this->cancel_worker(); }, &_cancel_thread).ok()); - REGISTER_HOOK_METRIC(plan_fragment_count, [this]() { - std::lock_guard lock(_lock); - return _fragment_map.size(); - }); // TODO(zc): we need a better thread-pool // now one user can use all the thread pool, others have no resource. ThreadPoolBuilder("FragmentMgrThreadPool") @@ -523,6 +527,7 @@ void FragmentMgr::cancel_worker() { } } } + timeout_canceled_fragment_count->increment(to_delete.size()); for (auto& id : to_delete) { cancel(id, PPlanFragmentCancelReason::TIMEOUT); LOG(INFO) << "FragmentMgr cancel worker going to cancel timeout fragment " << print_id(id); diff --git a/be/src/runtime/fragment_mgr.h b/be/src/runtime/fragment_mgr.h index 287664e63f0b95..6c5a24cfc75bd0 100644 --- a/be/src/runtime/fragment_mgr.h +++ b/be/src/runtime/fragment_mgr.h @@ -33,6 +33,7 @@ #include "http/rest_monitor_iface.h" #include "gutil/ref_counted.h" #include "util/countdown_latch.h" +#include "util/metrics.h" #include "util/thread.h" namespace doris { @@ -93,6 +94,9 @@ class FragmentMgr : public RestMonitorIface { scoped_refptr _cancel_thread; // every job is a pool std::unique_ptr _thread_pool; + + std::shared_ptr _entity = nullptr; + UIntGauge* timeout_canceled_fragment_count = nullptr; }; }