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

wyxxxcat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c88e640452 [improvement](recycler) Report per-instance recycle task 
activity (#70803)
2c88e640452 is described below

commit 2c88e6404523088ec7152e1c6ca0e18cd6bfae84
Author: Yixuan Wang <[email protected]>
AuthorDate: Wed Dec 2 20:55:48 2026 +0800

    [improvement](recycler) Report per-instance recycle task activity (#70803)
    
    ### Background
    
    Recycler task event counters report submitted, completed, and error
    events.
    Operators also need to see whether an instance is currently being
    recycled.
    
    ### What problem does this PR solve?
    
    Issue Number: None
    Related PR: #55455 (introduced the recycle task event counters)
    PR Type: Enhancement
    
    Problem Summary:
    
    Reusing the event metric name for a 0/1 gauge drops the status label and
    breaks existing error queries as Recycler nodes are upgraded. Publish
    activity under a separate metric name.
    
    ### Details
    
    - Add `recycler_instance_recycle_task_active{instance_id="..."}`, which
    reports `1` while the local Recycler handles a task and `0` after it
    exits.
    - **Configs and defaults:** None.
    - **Impact on existing users:** Existing event queries retain coverage
    during rolling upgrades. Upgraded Recycler nodes also expose the gauge.
    
    ### Release note
    
    Recycler exposes a per-instance gauge for current recycle activity.
    
    ### Check List (For Author)
    
    - Behavior changed: No
    - Does this need documentation: Yes. Document the gauge in the Recycler
      metrics reference.
---
 cloud/src/common/bvars.cpp      | 3 +++
 cloud/src/common/bvars.h        | 1 +
 cloud/src/recycler/recycler.cpp | 3 +++
 3 files changed, 7 insertions(+)

diff --git a/cloud/src/common/bvars.cpp b/cloud/src/common/bvars.cpp
index c35a4a57ffa..858469b60f1 100644
--- a/cloud/src/common/bvars.cpp
+++ b/cloud/src/common/bvars.cpp
@@ -152,6 +152,9 @@ bvar::Status<int64_t> 
g_bvar_recycler_task_max_concurrency("recycler_task_max_co
 // current status of recycle task (submitted, completed, error)
 mBvarIntAdder 
g_bvar_recycler_instance_recycle_task_status("recycler_instance_recycle_task_status",
 { "status"});
 // recycler's mbvars
+// 1 while the local Recycler is running a task for the instance, 0 when idle.
+mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_task_active(
+        "recycler_instance_recycle_task_active", {"instance_id"});
 // cost time of the last whole recycle process
 mBvarStatus<int64_t> 
g_bvar_recycler_instance_last_round_recycle_duration("recycler_instance_last_round_recycle_duration",{"instance_id"});
 mBvarStatus<int64_t> 
g_bvar_recycler_instance_next_ts("recycler_instance_next_ts",{"instance_id"});
diff --git a/cloud/src/common/bvars.h b/cloud/src/common/bvars.h
index def66302590..20e59a0f5f5 100644
--- a/cloud/src/common/bvars.h
+++ b/cloud/src/common/bvars.h
@@ -715,6 +715,7 @@ extern BvarStatusWithTag<int64_t> 
g_bvar_recycler_recycle_restore_job_earlest_ts
 // recycler's mbvars
 extern bvar::Status<int64_t> g_bvar_recycler_task_max_concurrency;
 extern mBvarIntAdder g_bvar_recycler_instance_recycle_task_status;
+extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_task_active;
 extern mBvarStatus<int64_t> 
g_bvar_recycler_instance_last_round_recycle_duration;
 extern mBvarStatus<int64_t> g_bvar_recycler_instance_next_ts;
 extern mBvarStatus<int64_t> g_bvar_recycler_instance_recycle_start_ts;
diff --git a/cloud/src/recycler/recycler.cpp b/cloud/src/recycler/recycler.cpp
index 9732171808e..ad5a3604e71 100644
--- a/cloud/src/recycler/recycler.cpp
+++ b/cloud/src/recycler/recycler.cpp
@@ -384,6 +384,7 @@ void Recycler::recycle_callback() {
             std::lock_guard lock(mtx_);
             // skip instance in recycling
             if (recycling_instance_map_.count(instance_id)) continue;
+            g_bvar_recycler_instance_recycle_task_active.put({instance_id}, 0);
         }
         if (!config::enable_recycler) {
             LOG(WARNING) << "Skip recycle instance_id=" << instance_id
@@ -415,6 +416,7 @@ void Recycler::recycle_callback() {
         auto ctime_ms = 
duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
         g_bvar_recycler_instance_recycle_start_ts.put({instance_id}, ctime_ms);
         g_bvar_recycler_instance_recycle_task_status.put({"submitted"}, 1);
+        g_bvar_recycler_instance_recycle_task_active.put({instance_id}, 1);
         ret = instance_recycler->do_recycle();
         // If instance recycler has been aborted, don't finish this job
 
@@ -427,6 +429,7 @@ void Recycler::recycle_callback() {
         }
         {
             std::lock_guard lock(mtx_);
+            g_bvar_recycler_instance_recycle_task_active.put({instance_id}, 0);
             recycling_instance_map_.erase(instance_id);
         }
 


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

Reply via email to