Skip to content

Commit

Permalink
[refactor](metrics) Remove IntAtomicCounter & CoreLocal #45742 (#45870)
Browse files Browse the repository at this point in the history
cherry pick from #45742
  • Loading branch information
zhiqiang-hhhh authored Dec 24, 2024
1 parent 6d6473e commit 64195d7
Show file tree
Hide file tree
Showing 14 changed files with 125 additions and 632 deletions.
6 changes: 3 additions & 3 deletions be/src/io/cache/block/block_file_cache_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ void FileCacheMetric::register_entity() {
entity = DorisMetrics::instance()->metric_registry()->register_entity(
std::string("cloud_file_cache"),
{{"table_id", table_id_str}, {"partition_id", partition_id_str}});
INT_ATOMIC_COUNTER_METRIC_REGISTER(entity, num_io_bytes_read_total);
INT_ATOMIC_COUNTER_METRIC_REGISTER(entity, num_io_bytes_read_from_cache);
INT_ATOMIC_COUNTER_METRIC_REGISTER(entity, num_io_bytes_read_from_remote);
INT_COUNTER_METRIC_REGISTER(entity, num_io_bytes_read_total);
INT_COUNTER_METRIC_REGISTER(entity, num_io_bytes_read_from_cache);
INT_COUNTER_METRIC_REGISTER(entity, num_io_bytes_read_from_remote);
entity->register_hook("cloud_file_cache",
std::bind(&FileCacheMetric::update_table_metrics, this));
}
Expand Down
6 changes: 3 additions & 3 deletions be/src/io/cache/block/block_file_cache_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ struct FileCacheMetric {
int64_t table_id = -1;
int64_t partition_id = -1;
std::shared_ptr<MetricEntity> entity;
IntAtomicCounter* num_io_bytes_read_total = nullptr;
IntAtomicCounter* num_io_bytes_read_from_cache = nullptr;
IntAtomicCounter* num_io_bytes_read_from_remote = nullptr;
IntCounter* num_io_bytes_read_total = nullptr;
IntCounter* num_io_bytes_read_from_cache = nullptr;
IntCounter* num_io_bytes_read_from_remote = nullptr;
};

struct FileCacheProfile {
Expand Down
7 changes: 4 additions & 3 deletions be/src/io/cache/block/block_lru_file_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "io/fs/local_file_system.h"
#include "io/fs/path.h"
#include "util/doris_metrics.h"
#include "util/metrics.h"
#include "util/slice.h"
#include "util/stopwatch.hpp"
#include "vec/common/hex.h"
Expand Down Expand Up @@ -101,9 +102,9 @@ LRUFileCache::LRUFileCache(const std::string& cache_base_path,
"lru_file_cache", {{"path", _cache_base_path}});
_entity->register_hook(_cache_base_path, std::bind(&LRUFileCache::update_cache_metrics, this));

INT_DOUBLE_METRIC_REGISTER(_entity, file_cache_hits_ratio);
INT_DOUBLE_METRIC_REGISTER(_entity, file_cache_hits_ratio_5m);
INT_DOUBLE_METRIC_REGISTER(_entity, file_cache_hits_ratio_1h);
DOUBLE_GAUGE_METRIC_REGISTER(_entity, file_cache_hits_ratio);
DOUBLE_GAUGE_METRIC_REGISTER(_entity, file_cache_hits_ratio_5m);
DOUBLE_GAUGE_METRIC_REGISTER(_entity, file_cache_hits_ratio_1h);
INT_UGAUGE_METRIC_REGISTER(_entity, file_cache_removed_elements);

INT_UGAUGE_METRIC_REGISTER(_entity, file_cache_index_queue_max_size);
Expand Down
8 changes: 4 additions & 4 deletions be/src/olap/lru_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ ShardedLRUCache::ShardedLRUCache(const std::string& name, size_t total_capacity,
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_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);
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
4 changes: 2 additions & 2 deletions be/src/olap/lru_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ 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;
IntCounter* cache_lookup_count = nullptr;
IntCounter* cache_hit_count = nullptr;
DoubleGauge* cache_hit_ratio = nullptr;
// bvars
std::unique_ptr<bvar::Adder<uint64_t>> _hit_count_bvar;
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.

14 changes: 7 additions & 7 deletions be/src/util/doris_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,13 @@ DorisMetrics::DorisMetrics() : _metric_registry(_s_registry_name) {
INT_GAUGE_METRIC_REGISTER(_server_metric_entity, local_file_open_writing);
INT_GAUGE_METRIC_REGISTER(_server_metric_entity, s3_file_open_writing);

INT_ATOMIC_COUNTER_METRIC_REGISTER(_server_metric_entity, query_ctx_cnt);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_ctx_cnt);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_cnt);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_task_cnt);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_task_queued);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_task_running);
INT_ATOMIC_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_task_submit_failed);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, query_ctx_cnt);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_ctx_cnt);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_cnt);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_task_cnt);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_task_queued);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_task_running);
INT_COUNTER_METRIC_REGISTER(_server_metric_entity, scanner_task_submit_failed);
}

void DorisMetrics::initialize(bool init_system_metrics, const std::set<std::string>& disk_devices,
Expand Down
Loading

0 comments on commit 64195d7

Please sign in to comment.