Graph the artwork thrown out, not the artwork kept (#198)
The sweep trims the cache to its limit, so the kept bytes it reports are the limit every time once the cache has filled: the panel was two lines flat at 500 MiB. A counter of images thrown out says whether the limit is too small. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,7 @@ pub fn trim(dir: &Path, limit: u64) -> usize {
|
||||
}
|
||||
}
|
||||
crate::metrics::STATS.art_cache_bytes.store(total, std::sync::atomic::Ordering::Relaxed);
|
||||
crate::metrics::STATS.art_trimmed.fetch_add(gone as u64, std::sync::atomic::Ordering::Relaxed);
|
||||
gone
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ pub struct Stats {
|
||||
/// When DeadAir started on the file it is on, Unix seconds; 0 when it is on none.
|
||||
pub deadair_busy_since: AtomicI64,
|
||||
pub art_cache_bytes: AtomicU64,
|
||||
/// Images the sweep threw out to keep under the limit: kept bytes sit at the limit by design,
|
||||
/// so this is what says whether the limit is too small.
|
||||
pub art_trimmed: AtomicU64,
|
||||
/// The library as the healthcheck last counted it, every 30 s; -1 until it has.
|
||||
pub feeds: AtomicI64,
|
||||
pub pending: AtomicI64,
|
||||
@@ -52,6 +55,7 @@ impl Stats {
|
||||
deadair_backlog: AtomicI64::new(0),
|
||||
deadair_busy_since: AtomicI64::new(0),
|
||||
art_cache_bytes: AtomicU64::new(0),
|
||||
art_trimmed: AtomicU64::new(0),
|
||||
feeds: AtomicI64::new(-1),
|
||||
pending: AtomicI64::new(-1),
|
||||
downloaded: AtomicI64::new(-1),
|
||||
@@ -205,6 +209,7 @@ fn work(out: &mut String, st: &Stats, event_queue: usize, retries: usize, art_li
|
||||
gauge(out, "ipx_feed_retries", "Feeds waiting to try a failed name lookup again.", &[("", retries as f64)]);
|
||||
gauge(out, "ipx_art_cache_bytes", "Artwork kept on disk, as of the last sweep.", &[("", st.art_cache_bytes.load(Relaxed) as f64)]);
|
||||
gauge(out, "ipx_art_cache_limit_bytes", "The most artwork kept.", &[("", art_limit as f64)]);
|
||||
counter(out, "ipx_art_trimmed_total", "Images thrown out to keep the artwork under its limit.", &[("", st.art_trimmed.load(Relaxed) as f64)]);
|
||||
for (name, help, v) in [
|
||||
("ipx_feeds", "Feeds in the catalogue, as the healthcheck last counted.", &st.feeds),
|
||||
("ipx_downloads_pending", "Files a scan will download on its own, as the healthcheck last counted.", &st.pending),
|
||||
|
||||
Reference in New Issue
Block a user