chore: add logs and metrics (#2858)

* chore: add logs and metrics

* feat: add the timer to track heartbeat intervel

* feat: add the gauge to track region leases

* refactor: use gauge instead of the timer

* chore: apply suggestions from CR

* feat: add hit rate and etcd txn metrics
This commit is contained in:
Weny Xu
2023-12-04 11:51:30 +09:00
committed by GitHub
parent 781f2422b3
commit c26f2f94c0
8 changed files with 105 additions and 5 deletions

View File

@@ -68,6 +68,9 @@ impl EtcdStore {
async fn do_multi_txn(&self, txn_ops: Vec<TxnOp>) -> Result<Vec<TxnResponse>> {
if txn_ops.len() < MAX_TXN_SIZE {
// fast path
let _timer = METRIC_META_TXN_REQUEST
.with_label_values(&["etcd", "txn"])
.start_timer();
let txn = Txn::new().and_then(txn_ops);
let txn_res = self
.client
@@ -81,6 +84,9 @@ impl EtcdStore {
let txns = txn_ops
.chunks(MAX_TXN_SIZE)
.map(|part| async move {
let _timer = METRIC_META_TXN_REQUEST
.with_label_values(&["etcd", "txn"])
.start_timer();
let txn = Txn::new().and_then(part);
self.client.kv_client().txn(txn).await
})