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

[refactor](metrics) Remove IntAtomicCounter & CoreLocal #45742

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions be/src/olap/lru_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,12 @@ ShardedLRUCache::ShardedLRUCache(const std::string& name, size_t capacity, LRUCa
INT_GAUGE_METRIC_REGISTER(_entity, cache_capacity);
INT_GAUGE_METRIC_REGISTER(_entity, cache_usage);
INT_GAUGE_METRIC_REGISTER(_entity, cache_element_count);
INT_DOUBLE_METRIC_REGISTER(_entity, cache_usage_ratio);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_entity, cache_lookup_count);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_entity, cache_hit_count);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_entity, cache_stampede_count);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_entity, cache_miss_count);
INT_DOUBLE_METRIC_REGISTER(_entity, cache_hit_ratio);
DOUBLE_GAUGE_METRIC_REGISTER(_entity, cache_usage_ratio);
INT_COUNTER_METRIC_REGISTER(_entity, cache_lookup_count);
INT_COUNTER_METRIC_REGISTER(_entity, cache_hit_count);
INT_COUNTER_METRIC_REGISTER(_entity, cache_stampede_count);
INT_COUNTER_METRIC_REGISTER(_entity, cache_miss_count);
DOUBLE_GAUGE_METRIC_REGISTER(_entity, cache_hit_ratio);

_hit_count_bvar.reset(new bvar::Adder<uint64_t>("doris_cache", _name));
_hit_count_per_second.reset(new bvar::PerSecond<bvar::Adder<uint64_t>>(
Expand Down
8 changes: 4 additions & 4 deletions be/src/olap/lru_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@ class ShardedLRUCache : public Cache {
IntGauge* cache_usage = nullptr;
IntGauge* cache_element_count = nullptr;
DoubleGauge* cache_usage_ratio = nullptr;
IntAtomicCounter* cache_lookup_count = nullptr;
IntAtomicCounter* cache_hit_count = nullptr;
IntAtomicCounter* cache_miss_count = nullptr;
IntAtomicCounter* cache_stampede_count = nullptr;
IntCounter* cache_lookup_count = nullptr;
IntCounter* cache_hit_count = nullptr;
IntCounter* cache_miss_count = nullptr;
IntCounter* cache_stampede_count = nullptr;
DoubleGauge* cache_hit_ratio = nullptr;
// bvars
std::unique_ptr<bvar::Adder<uint64_t>> _hit_count_bvar;
Expand Down
17 changes: 8 additions & 9 deletions be/src/runtime/workload_group/workload_group_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,31 @@ WorkloadGroupMetrics::WorkloadGroupMetrics(WorkloadGroup* wg) {

_cpu_time_metric = std::make_unique<doris::MetricPrototype>(
doris::MetricType::COUNTER, doris::MetricUnit::SECONDS, "workload_group_cpu_time_sec");
_cpu_time_counter =
(IntAtomicCounter*)(_entity->register_metric<IntAtomicCounter>(_cpu_time_metric.get()));
_cpu_time_counter = (IntCounter*)(_entity->register_metric<IntCounter>(_cpu_time_metric.get()));

_mem_used_bytes_metric = std::make_unique<doris::MetricPrototype>(
doris::MetricType::COUNTER, doris::MetricUnit::BYTES, "workload_group_mem_used_bytes");
_mem_used_bytes_counter = (IntAtomicCounter*)(_entity->register_metric<IntAtomicCounter>(
_mem_used_bytes_metric.get()));
_mem_used_bytes_counter =
(IntCounter*)(_entity->register_metric<IntCounter>(_mem_used_bytes_metric.get()));

_local_scan_bytes_metric = std::make_unique<doris::MetricPrototype>(
doris::MetricType::COUNTER, doris::MetricUnit::BYTES,
"workload_group_local_scan_bytes");
_local_scan_bytes_counter = (IntAtomicCounter*)(_entity->register_metric<IntAtomicCounter>(
_local_scan_bytes_metric.get()));
_local_scan_bytes_counter =
(IntCounter*)(_entity->register_metric<IntCounter>(_local_scan_bytes_metric.get()));

_remote_scan_bytes_metric = std::make_unique<doris::MetricPrototype>(
doris::MetricType::COUNTER, doris::MetricUnit::BYTES,
"workload_group_remote_scan_bytes");
_remote_scan_bytes_counter = (IntAtomicCounter*)(_entity->register_metric<IntAtomicCounter>(
_remote_scan_bytes_metric.get()));
_remote_scan_bytes_counter =
(IntCounter*)(_entity->register_metric<IntCounter>(_remote_scan_bytes_metric.get()));

for (const auto& [key, io_throttle] : wg->_scan_io_throttle_map) {
std::unique_ptr<doris::MetricPrototype> metric = std::make_unique<doris::MetricPrototype>(
doris::MetricType::COUNTER, doris::MetricUnit::BYTES,
"workload_group_local_scan_bytes_" + io_throttle->metric_name());
_local_scan_bytes_counter_map[key] =
(IntAtomicCounter*)(_entity->register_metric<IntAtomicCounter>(metric.get()));
(IntCounter*)(_entity->register_metric<IntCounter>(metric.get()));
_local_scan_bytes_metric_map[key] = std::move(metric);
}
}
Expand Down
12 changes: 6 additions & 6 deletions be/src/runtime/workload_group/workload_group_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class WorkloadGroup;

template <typename T>
class AtomicCounter;
using IntAtomicCounter = AtomicCounter<int64_t>;
using IntCounter = AtomicCounter<int64_t>;
class MetricEntity;
struct MetricPrototype;

Expand Down Expand Up @@ -65,11 +65,11 @@ class WorkloadGroupMetrics {
// _local_disk_io_metric is every disk's IO
std::map<std::string, std::unique_ptr<doris::MetricPrototype>> _local_scan_bytes_metric_map;

IntAtomicCounter* _cpu_time_counter {nullptr}; // used for metric
IntAtomicCounter* _mem_used_bytes_counter {nullptr}; // used for metric
IntAtomicCounter* _local_scan_bytes_counter {nullptr}; // used for metric
IntAtomicCounter* _remote_scan_bytes_counter {nullptr}; // used for metric
std::map<std::string, IntAtomicCounter*> _local_scan_bytes_counter_map; // used for metric
IntCounter* _cpu_time_counter {nullptr}; // used for metric
IntCounter* _mem_used_bytes_counter {nullptr}; // used for metric
IntCounter* _local_scan_bytes_counter {nullptr}; // used for metric
IntCounter* _remote_scan_bytes_counter {nullptr}; // used for metric
std::map<std::string, IntCounter*> _local_scan_bytes_counter_map; // used for metric

std::atomic<uint64_t> _cpu_time_nanos {0};
std::atomic<uint64_t> _last_cpu_time_nanos {0};
Expand Down
129 changes: 0 additions & 129 deletions be/src/util/core_local.cpp

This file was deleted.

162 changes: 0 additions & 162 deletions be/src/util/core_local.h

This file was deleted.

Loading
Loading