yiguolei commented on code in PR #29591: URL: https://github.com/apache/doris/pull/29591#discussion_r1442599860
########## be/src/common/daemon.cpp: ########## @@ -352,6 +354,65 @@ void Daemon::block_spill_gc_thread() { } } +void Daemon::report_be_workload_runtime_stats_thread() { + while (!_stop_background_threads_latch.wait_for(std::chrono::milliseconds(1000))) { + std::map<TNetworkAddress, TReportWorkloadRuntimeStatusParams> fe_id_query_stats; + // 1 get merged query statistics + { + // add a code block here because we should release query_ctx_map quickly + std::unordered_map<TUniqueId, std::shared_ptr<QueryContext>>& query_ctx_map = + ExecEnv::GetInstance()->fragment_mgr()->get_query_ctx_map(); + + for (const auto& [query_id, query_ctx_ptr] : query_ctx_map) { + std::unique_ptr<QueryStatistics> query_stats = + query_ctx_ptr->get_merged_query_statistics(); + TNetworkAddress addr = query_ctx_ptr->coord_addr; + if (fe_id_query_stats.find(addr) == fe_id_query_stats.end()) { + TReportWorkloadRuntimeStatusParams treport_params; + treport_params.__set_backend_id(123); + fe_id_query_stats[addr] = treport_params; + } + + TQueryStatistics tquery_stats; + tquery_stats.__set_scan_rows(query_stats->get_scan_rows()); Review Comment: add a method in QueryStatistics name toThrift(TQueryStatistics) to encapsulate this set_scan_rows logic. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org