[Bug] System metric init failed cause be start failed (#5262)
System metric init failed cause be start failed
This commit is contained in:
@ -289,6 +289,11 @@ void Daemon::start() {
|
||||
CHECK(st.ok()) << st.to_string();
|
||||
|
||||
if (config::enable_metric_calculator) {
|
||||
CHECK(DorisMetrics::instance()->is_inited())
|
||||
<< "enable metric calculator failed, maybe you set enable_system_metrics to false "
|
||||
<< " or there may be some hardware error which causes metric init failed, please check log first;"
|
||||
<< " you can set enable_metric_calculator = false to quickly recover ";
|
||||
|
||||
st = Thread::create(
|
||||
"Daemon", "calculate_metrics_thread",
|
||||
[this]() { this->calculate_metrics_thread(); }, &_calculate_metrics_thread);
|
||||
|
||||
@ -281,6 +281,7 @@ void DorisMetrics::initialize(bool init_system_metrics, const std::set<std::stri
|
||||
if (init_system_metrics) {
|
||||
_system_metrics.reset(
|
||||
new SystemMetrics(&_metric_registry, disk_devices, network_interfaces));
|
||||
_is_inited = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -194,6 +194,7 @@ public:
|
||||
MetricRegistry* metric_registry() { return &_metric_registry; }
|
||||
SystemMetrics* system_metrics() { return _system_metrics.get(); }
|
||||
MetricEntity* server_entity() { return _server_metric_entity.get(); }
|
||||
bool is_inited() { return _is_inited; }
|
||||
|
||||
private:
|
||||
// Don't allow constructor
|
||||
@ -212,6 +213,8 @@ private:
|
||||
std::unique_ptr<SystemMetrics> _system_metrics;
|
||||
|
||||
std::shared_ptr<MetricEntity> _server_metric_entity;
|
||||
|
||||
bool _is_inited = false;
|
||||
};
|
||||
|
||||
}; // namespace doris
|
||||
|
||||
Reference in New Issue
Block a user