Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions source/common/event/dispatcher_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ DispatcherImpl::DispatcherImpl(Buffer::WatermarkFactoryPtr&& factory, Api::Api&
DispatcherImpl::~DispatcherImpl() {}

void DispatcherImpl::initializeStats(Stats::Scope& scope, const std::string& prefix) {
stats_prefix_ = prefix + "dispatcher";
stats_ = std::make_unique<DispatcherStats>(
DispatcherStats{ALL_DISPATCHER_STATS(POOL_HISTOGRAM_PREFIX(scope, stats_prefix_ + "."))});
base_scheduler_.initializeStats(stats_.get());
// This needs to be run in the dispatcher's thread, so that we have a thread id to log.
post([this, &scope, prefix] {
stats_prefix_ = prefix + "dispatcher";
stats_ = std::make_unique<DispatcherStats>(
DispatcherStats{ALL_DISPATCHER_STATS(POOL_HISTOGRAM_PREFIX(scope, stats_prefix_ + "."))});
base_scheduler_.initializeStats(stats_.get());
ENVOY_LOG(debug, "running {} on thread {}", stats_prefix_, run_tid_->debugString());
});
}

void DispatcherImpl::clearDeferredDeleteList() {
Expand Down Expand Up @@ -165,9 +169,6 @@ void DispatcherImpl::post(std::function<void()> callback) {

void DispatcherImpl::run(RunType type) {
run_tid_ = api_.threadFactory().currentThreadId();
if (!stats_prefix_.empty()) {
ENVOY_LOG(debug, "running {} on thread {}", stats_prefix_, run_tid_->debugString());
}

// Flush all post callbacks before we run the event loop. We do this because there are post
// callbacks that have to get run before the initial event loop starts running. libevent does
Expand Down