Skip to content

Commit

Permalink
chore(kv): add metrics while pushing to stream (#3364)
Browse files Browse the repository at this point in the history
  • Loading branch information
dracarys18 authored Jan 30, 2024
1 parent ac49103 commit 8c0c49c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/storage_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ impl<T: DatabaseStore> KVRouterStore<T> {
.change_context(RedisError::JsonSerializationFailed)?,
)
.await
.map(|_| metrics::KV_PUSHED_TO_DRAINER.add(&metrics::CONTEXT, 1, &[]))
.map_err(|err| {
metrics::KV_FAILED_TO_PUSH_TO_DRAINER.add(&metrics::CONTEXT, 1, &[]);
err
})
.change_context(RedisError::StreamAppendFailed)
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/storage_impl/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ counter_metric!(KV_MISS, GLOBAL_METER); // No. of KV misses
// Metrics for KV
counter_metric!(KV_OPERATION_SUCCESSFUL, GLOBAL_METER);
counter_metric!(KV_OPERATION_FAILED, GLOBAL_METER);
counter_metric!(KV_PUSHED_TO_DRAINER, GLOBAL_METER);
counter_metric!(KV_FAILED_TO_PUSH_TO_DRAINER, GLOBAL_METER);

0 comments on commit 8c0c49c

Please sign in to comment.