@@ -487,71 +487,4 @@ void MetricRegistry::get_be_metrics_block(vectorized::Block* block) const {
487487 }
488488}
489489
490- void MetricRegistry::get_be_metrics_block (vectorized::Block* block) const {
491- int64_t be_id = ExecEnv::GetInstance ()->cluster_info ()->backend_id ;
492- std::string be_ip = BackendOptions::get_localhost ();
493-
494- std::lock_guard<std::mutex> l (_lock);
495- for (const auto & entity : _entities) {
496- std::lock_guard<std::mutex> entity_lock (entity.first ->_lock );
497- entity.first ->trigger_hook_unlocked (false );
498-
499- for (const auto & metric : entity.first ->_metrics ) {
500- rj::Document tag_doc (rj::kObjectType );
501- rj::Document::AllocatorType& allocator = tag_doc.GetAllocator ();
502-
503- for (auto & label : metric.first ->labels ) {
504- tag_doc.AddMember (
505- rj::Value (label.first .c_str (), allocator),
506- rj::Value (label.second .c_str (), allocator),
507- allocator
508- );
509- }
510-
511- for (auto & label : entity.first ->_labels ) {
512- tag_doc.AddMember (
513- rj::Value (label.first .c_str (), allocator),
514- rj::Value (label.second .c_str (), allocator),
515- allocator
516- );
517- }
518-
519- rj::StringBuffer tag_buf;
520- rj::Writer<rj::StringBuffer> tag_writer (tag_buf);
521- tag_doc.Accept (tag_writer);
522- std::string tag_str = tag_buf.GetString ();
523-
524- std::string metric_type;
525- switch (metric.first ->type ) {
526- case MetricType::COUNTER:
527- metric_type = " counter" ;
528- break ;
529- case MetricType::GAUGE:
530- metric_type = " gauge" ;
531- break ;
532- case MetricType::HISTOGRAM:
533- metric_type = " histogram" ;
534- break ;
535- default :
536- metric_type = " unknown" ;
537- }
538-
539- double metric_value = 0.0 ;
540- try {
541- std::string value_str = metric.second ->to_string ();
542- metric_value = std::stod (value_str); // 字符串转double
543- } catch (...) {
544- }
545-
546- // BE_ID(0), BE_IP(1), METRIC_NAME(2), METRIC_TYPE(3), METRIC_VALUE(4), TAG(5)
547- SchemaScannerHelper::insert_int64_value (0 , be_id, block);
548- SchemaScannerHelper::insert_string_value (1 , be_ip, block);
549- SchemaScannerHelper::insert_string_value (2 , metric.first ->simple_name (), block);
550- SchemaScannerHelper::insert_string_value (3 , metric_type, block);
551- SchemaScannerHelper::insert_double_value (4 , metric_value, block);
552- SchemaScannerHelper::insert_string_value (5 , tag_str, block);
553- }
554- }
555- }
556-
557490} // namespace doris
0 commit comments