Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: supply the metric on storage usage. #326

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ where
/// Purges expired logs files and returns a set of Raft group ids that need
/// to be compacted.
pub fn purge_expired_files(&self) -> Result<Vec<u64>> {
self.purge_manager.purge_expired_files()
let purged = self.purge_manager.purge_expired_files();
// Update storage size after purge.
STORAGE_USAGE.set(self.get_used_size() as i64);
purged
}

/// Returns count of fetched entries.
Expand Down
5 changes: 5 additions & 0 deletions src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ lazy_static! {
&["type"]
)
.unwrap();
pub static ref STORAGE_USAGE: IntGauge = register_int_gauge!(
"raft_engine_storage_usage",
"Storage usage in bytes occupied by Raft engine",
)
.unwrap();
pub static ref MEMORY_USAGE: IntGauge = register_int_gauge!(
"raft_engine_memory_usage",
"Memory in bytes used by Raft engine",
Expand Down
Loading