Skip to content

Commit

Permalink
[improve](cloud-mow)Add delete bitmap metrics for MS (#47047)
Browse files Browse the repository at this point in the history
When reading or writing delete bitmap fail, record failed count to
metrics.
  • Loading branch information
hust-hhb authored Jan 26, 2025
1 parent c066d4f commit 92e2285
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cloud/src/common/bvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ BvarLatencyRecorderWithTag g_bvar_ms_finish_tablet_job("ms", "finish_tablet_job"
BvarLatencyRecorderWithTag g_bvar_ms_get_cluster_status("ms", "get_cluster_status");
BvarLatencyRecorderWithTag g_bvar_ms_set_cluster_status("ms", "set_cluster_status");
BvarLatencyRecorderWithTag g_bvar_ms_check_kv("ms", "check_kv");
bvar::Adder<int64_t> g_bvar_update_delete_bitmap_fail_counter;
bvar::Window<bvar::Adder<int64_t> > g_bvar_update_delete_bitmap_fail_counter_minute("ms", "update_delete_bitmap_fail", &g_bvar_update_delete_bitmap_fail_counter, 60);
bvar::Adder<int64_t> g_bvar_get_delete_bitmap_fail_counter;
bvar::Window<bvar::Adder<int64_t> > g_bvar_get_delete_bitmap_fail_counter_minute("ms", "get_delete_bitmap_fail", &g_bvar_get_delete_bitmap_fail_counter, 60);


// recycler's bvars
// TODO: use mbvar for per instance, https://github.com/apache/brpc/blob/master/docs/cn/mbvar_c++.md
Expand Down
2 changes: 2 additions & 0 deletions cloud/src/common/bvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ extern BvarLatencyRecorderWithTag g_bvar_ms_get_rl_task_commit_attach;
extern BvarLatencyRecorderWithTag g_bvar_ms_reset_rl_progress;
extern BvarLatencyRecorderWithTag g_bvar_ms_get_txn_id;
extern BvarLatencyRecorderWithTag g_bvar_ms_check_kv;
extern bvar::Adder<int64_t> g_bvar_update_delete_bitmap_fail_counter;
extern bvar::Adder<int64_t> g_bvar_get_delete_bitmap_fail_counter;

// recycler's bvars
extern BvarStatusWithTag<int64_t> g_bvar_recycler_recycle_index_earlest_ts;
Expand Down
4 changes: 4 additions & 0 deletions cloud/src/meta-service/meta_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,7 @@ void MetaServiceImpl::update_delete_bitmap(google::protobuf::RpcController* cont
<< " put_size=" << txn->put_bytes() << " num_put_keys=" << txn->num_put_keys()
<< " txn_size=" << txn->approximate_bytes();
msg = ss.str();
g_bvar_update_delete_bitmap_fail_counter << 1;
return;
}
current_key_count = 0;
Expand Down Expand Up @@ -1963,6 +1964,7 @@ void MetaServiceImpl::update_delete_bitmap(google::protobuf::RpcController* cont
<< " delete_bitmap_value=" << current_value_count << " put_size=" << txn->put_bytes()
<< " num_put_keys=" << txn->num_put_keys() << " txn_size=" << txn->approximate_bytes();
msg = ss.str();
g_bvar_update_delete_bitmap_fail_counter << 1;
return;
}
LOG(INFO) << "update_delete_bitmap tablet_id=" << tablet_id << " lock_id=" << request->lock_id()
Expand Down Expand Up @@ -2075,6 +2077,7 @@ void MetaServiceImpl::get_delete_bitmap(google::protobuf::RpcController* control
ss << "internal error, failed to get delete bitmap, internal round=" << round
<< ", ret=" << err;
msg = ss.str();
g_bvar_get_delete_bitmap_fail_counter << 1;
return;
}

Expand Down Expand Up @@ -2118,6 +2121,7 @@ void MetaServiceImpl::get_delete_bitmap(google::protobuf::RpcController* control
<< ",exceed max byte";
msg = ss.str();
LOG(WARNING) << msg;
g_bvar_get_delete_bitmap_fail_counter << 1;
return;
}
round++;
Expand Down

0 comments on commit 92e2285

Please sign in to comment.