Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

branch-3.0: [opt](metrics) Remove IntervalHistogramStat #47459 #47606

Open
wants to merge 1 commit into
base: branch-3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
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
80 changes: 0 additions & 80 deletions be/src/util/interval_histogram.cpp

This file was deleted.

46 changes: 0 additions & 46 deletions be/src/util/interval_histogram.h

This file was deleted.

18 changes: 6 additions & 12 deletions be/src/util/threadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_queue_size, MetricUnit::NOUNIT);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_max_queue_size, MetricUnit::NOUNIT);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(thread_pool_max_threads, MetricUnit::NOUNIT);
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(thread_pool_submit_failed, MetricUnit::NOUNIT);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(task_execution_time_ns_avg_in_last_1000_times,
MetricUnit::NANOSECONDS);
DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(task_wait_worker_ns_avg_in_last_1000_times,
MetricUnit::NANOSECONDS);
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(task_execution_time_ns_total, MetricUnit::NANOSECONDS);
DEFINE_COUNTER_METRIC_PROTOTYPE_2ARG(task_wait_worker_time_ns_total, MetricUnit::NANOSECONDS);
using namespace ErrorCode;

using std::string;
Expand Down Expand Up @@ -296,8 +294,8 @@ Status ThreadPool::init() {
INT_GAUGE_METRIC_REGISTER(_metric_entity, thread_pool_max_threads);
INT_GAUGE_METRIC_REGISTER(_metric_entity, thread_pool_queue_size);
INT_GAUGE_METRIC_REGISTER(_metric_entity, thread_pool_max_queue_size);
INT_GAUGE_METRIC_REGISTER(_metric_entity, task_execution_time_ns_avg_in_last_1000_times);
INT_GAUGE_METRIC_REGISTER(_metric_entity, task_wait_worker_ns_avg_in_last_1000_times);
INT_COUNTER_METRIC_REGISTER(_metric_entity, task_execution_time_ns_total);
INT_COUNTER_METRIC_REGISTER(_metric_entity, task_wait_worker_time_ns_total);
INT_COUNTER_METRIC_REGISTER(_metric_entity, thread_pool_submit_failed);

_metric_entity->register_hook("update", [this]() {
Expand All @@ -312,10 +310,6 @@ Status ThreadPool::init() {
thread_pool_queue_size->set_value(get_queue_size());
thread_pool_max_queue_size->set_value(get_max_queue_size());
thread_pool_max_threads->set_value(max_threads());
task_execution_time_ns_avg_in_last_1000_times->set_value(
_task_execution_time_ns_statistic.mean());
task_wait_worker_ns_avg_in_last_1000_times->set_value(
_task_wait_worker_time_ns_statistic.mean());
});
return Status::OK();
}
Expand Down Expand Up @@ -587,7 +581,7 @@ void ThreadPool::dispatch_thread() {
DCHECK_EQ(ThreadPoolToken::State::RUNNING, token->state());
DCHECK(!token->_entries.empty());
Task task = std::move(token->_entries.front());
_task_wait_worker_time_ns_statistic.add(task.submit_time_wather.elapsed_time());
task_wait_worker_time_ns_total->increment(task.submit_time_wather.elapsed_time());
token->_entries.pop_front();
token->_active_threads++;
--_total_queued_tasks;
Expand All @@ -605,7 +599,7 @@ void ThreadPool::dispatch_thread() {
// with this threadpool, and produce a deadlock.
task.runnable.reset();
l.lock();
_task_execution_time_ns_statistic.add(task_execution_time_watch.elapsed_time());
task_execution_time_ns_total->increment(task_execution_time_watch.elapsed_time());
// Possible states:
// 1. The token was shut down while we ran its task. Transition to QUIESCED.
// 2. The token has no more queued tasks. Transition back to IDLE.
Expand Down
8 changes: 2 additions & 6 deletions be/src/util/threadpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

#include "agent/cgroup_cpu_ctl.h"
#include "common/status.h"
#include "util/interval_histogram.h"
#include "util/metrics.h"
#include "util/uid_util.h"
#include "util/work_thread_pool.hpp"
Expand Down Expand Up @@ -411,11 +410,8 @@ class ThreadPool {
IntGauge* thread_pool_queue_size = nullptr;
IntGauge* thread_pool_max_queue_size = nullptr;
IntGauge* thread_pool_max_threads = nullptr;
IntGauge* task_execution_time_ns_avg_in_last_1000_times = nullptr;
IntGauge* task_wait_worker_ns_avg_in_last_1000_times = nullptr;

IntervalHistogramStat<int64_t> _task_execution_time_ns_statistic {1000};
IntervalHistogramStat<int64_t> _task_wait_worker_time_ns_statistic {1000};
IntCounter* task_execution_time_ns_total = nullptr;
IntCounter* task_wait_worker_time_ns_total = nullptr;

IntCounter* thread_pool_submit_failed = nullptr;
};
Expand Down
78 changes: 0 additions & 78 deletions be/test/util/interval_histogram_test.cpp

This file was deleted.