Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
yiguolei committed Dec 27, 2024
1 parent bfca486 commit 1b3312c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions be/src/runtime/exec_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class ProcessProfile;
class HeapProfiler;
class WalManager;
class DNSCache;
class DorisMetrics;

inline bool k_doris_exit = false;

Expand Down Expand Up @@ -233,6 +234,7 @@ class ExecEnv {
LoadPathMgr* load_path_mgr() { return _load_path_mgr; }
BfdParser* bfd_parser() const { return _bfd_parser; }
BrokerMgr* broker_mgr() const { return _broker_mgr; }
DorisMetrics* doris_metrics() { return _doris_metrics; }
BrpcClientCache<PBackendService_Stub>* brpc_internal_client_cache() const {
return _internal_client_cache;
}
Expand Down
4 changes: 4 additions & 0 deletions be/src/runtime/exec_env_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ Status ExecEnv::_init(const std::vector<StorePath>& store_paths,
if (ready()) {
return Status::OK();
}
// Doris Metrics is firstly initialized.
_doris_metrics = std::make_unique<DorisMetrics>();

std::unordered_map<std::string, std::unique_ptr<vectorized::SpillDataDir>> spill_store_map;
for (const auto& spill_path : spill_store_paths) {
spill_store_map.emplace(spill_path.path, std::make_unique<vectorized::SpillDataDir>(
Expand Down Expand Up @@ -842,6 +845,7 @@ void ExecEnv::destroy() {
SAFE_DELETE(_heap_profiler);

_s_tracking_memory = false;
_doris_metrics.reset();

LOG(INFO) << "Doris exec envorinment is destoried.";
}
Expand Down
5 changes: 1 addition & 4 deletions be/src/util/doris_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,7 @@ class DorisMetrics {
IntCounter* scanner_task_submit_failed = nullptr;
IntCounter* scanner_task_running = nullptr;

static DorisMetrics* instance() {
static DorisMetrics instance;
return &instance;
}
static DorisMetrics* instance() { return ExecEnv::GetInstance()->doris_metrics(); }

// not thread-safe, call before calling metrics
void initialize(
Expand Down

0 comments on commit 1b3312c

Please sign in to comment.