Skip to content

Commit

Permalink
feat(cache): Emit current size metric on cleanup (#1484)
Browse files Browse the repository at this point in the history
  • Loading branch information
loewenheim authored Jun 14, 2024
1 parent 37faba3 commit d7f6a0b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/symbolicator-service/src/caching/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use rand::seq::SliceRandom;
use rand::thread_rng;

use crate::config::Config;
use crate::metric;

use super::fs::catch_not_found;
use super::{Cache, Caches};
Expand Down Expand Up @@ -128,6 +129,11 @@ impl Cache {
stats.removed_bytes
);

metric!(gauge("caches.size.files") = stats.retained_files as u64, "cache" => self.name.as_ref());
metric!(gauge("caches.size.bytes") = stats.retained_bytes, "cache" => self.name.as_ref());
metric!(counter("caches.size.files_removed") += stats.removed_files as i64, "cache" => self.name.as_ref());
metric!(counter("caches.size.bytes_removed") += stats.removed_bytes as i64, "cache" => self.name.as_ref());

Ok(())
}

Expand Down

0 comments on commit d7f6a0b

Please sign in to comment.