This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 4b85b60df91 branch-3.0: [enhancement](cloud) expose file cache 
capacity for each disk (#42896)
4b85b60df91 is described below

commit 4b85b60df91c20ec5a55c2fc6d68e7f40163cb95
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Nov 7 14:08:40 2024 +0800

    branch-3.0: [enhancement](cloud) expose file cache capacity for each disk 
(#42896)
    
    PR Body: expose file cache capacity for better monitoring and easier to
    calculate file cache space usage using prometheus.
    
    ## Proposed changes
    
    Issue Number: close #xxx
    
    <!--Describe your changes.-->
    
    
     Cherry-picked from #42867
    
    Signed-off-by: freemandealer <[email protected]>
    Co-authored-by: zhengyu <[email protected]>
---
 be/src/io/cache/block_file_cache.cpp | 3 +++
 be/src/io/cache/block_file_cache.h   | 1 +
 2 files changed, 4 insertions(+)

diff --git a/be/src/io/cache/block_file_cache.cpp 
b/be/src/io/cache/block_file_cache.cpp
index 1a840e2dc6f..230f02ef07e 100644
--- a/be/src/io/cache/block_file_cache.cpp
+++ b/be/src/io/cache/block_file_cache.cpp
@@ -54,6 +54,8 @@ BlockFileCache::BlockFileCache(const std::string& 
cache_base_path,
           _max_query_cache_size(cache_settings.max_query_cache_size) {
     _cur_cache_size_metrics = 
std::make_shared<bvar::Status<size_t>>(_cache_base_path.c_str(),
                                                                      
"file_cache_cache_size", 0);
+    _cache_capacity_metrics = std::make_shared<bvar::Status<size_t>>(
+            _cache_base_path.c_str(), "file_cache_capacity", _capacity);
     _cur_ttl_cache_size_metrics = std::make_shared<bvar::Status<size_t>>(
             _cache_base_path.c_str(), "file_cache_ttl_cache_size", 0);
     _cur_normal_queue_element_count_metrics = 
std::make_shared<bvar::Status<size_t>>(
@@ -1649,6 +1651,7 @@ std::string BlockFileCache::reset_capacity(size_t 
new_capacity) {
         }
         old_capacity = _capacity;
         _capacity = new_capacity;
+        _cache_capacity_metrics->set_value(_capacity);
     }
     auto use_time = duration_cast<milliseconds>(steady_clock::time_point() - 
start_time);
     LOG(INFO) << "Finish tag deleted block. path=" << _cache_base_path
diff --git a/be/src/io/cache/block_file_cache.h 
b/be/src/io/cache/block_file_cache.h
index c0c66334a2b..1511899abe6 100644
--- a/be/src/io/cache/block_file_cache.h
+++ b/be/src/io/cache/block_file_cache.h
@@ -459,6 +459,7 @@ private:
     LRUQueue _ttl_queue;
 
     // metrics
+    std::shared_ptr<bvar::Status<size_t>> _cache_capacity_metrics;
     std::shared_ptr<bvar::Status<size_t>> _cur_cache_size_metrics;
     std::shared_ptr<bvar::Status<size_t>> _cur_ttl_cache_size_metrics;
     std::shared_ptr<bvar::Status<size_t>> 
_cur_ttl_cache_lru_queue_cache_size_metrics;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to