Skip to content

Commit 1b3312c

Browse files
committed
f
1 parent bfca486 commit 1b3312c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

be/src/runtime/exec_env.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class ProcessProfile;
114114
class HeapProfiler;
115115
class WalManager;
116116
class DNSCache;
117+
class DorisMetrics;
117118

118119
inline bool k_doris_exit = false;
119120

@@ -233,6 +234,7 @@ class ExecEnv {
233234
LoadPathMgr* load_path_mgr() { return _load_path_mgr; }
234235
BfdParser* bfd_parser() const { return _bfd_parser; }
235236
BrokerMgr* broker_mgr() const { return _broker_mgr; }
237+
DorisMetrics* doris_metrics() { return _doris_metrics; }
236238
BrpcClientCache<PBackendService_Stub>* brpc_internal_client_cache() const {
237239
return _internal_client_cache;
238240
}

be/src/runtime/exec_env_init.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ Status ExecEnv::_init(const std::vector<StorePath>& store_paths,
204204
if (ready()) {
205205
return Status::OK();
206206
}
207+
// Doris Metrics is firstly initialized.
208+
_doris_metrics = std::make_unique<DorisMetrics>();
209+
207210
std::unordered_map<std::string, std::unique_ptr<vectorized::SpillDataDir>> spill_store_map;
208211
for (const auto& spill_path : spill_store_paths) {
209212
spill_store_map.emplace(spill_path.path, std::make_unique<vectorized::SpillDataDir>(
@@ -842,6 +845,7 @@ void ExecEnv::destroy() {
842845
SAFE_DELETE(_heap_profiler);
843846

844847
_s_tracking_memory = false;
848+
_doris_metrics.reset();
845849

846850
LOG(INFO) << "Doris exec envorinment is destoried.";
847851
}

be/src/util/doris_metrics.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,7 @@ class DorisMetrics {
248248
IntCounter* scanner_task_submit_failed = nullptr;
249249
IntCounter* scanner_task_running = nullptr;
250250

251-
static DorisMetrics* instance() {
252-
static DorisMetrics instance;
253-
return &instance;
254-
}
251+
static DorisMetrics* instance() { return ExecEnv::GetInstance()->doris_metrics(); }
255252

256253
// not thread-safe, call before calling metrics
257254
void initialize(

0 commit comments

Comments
 (0)