feat(admin): observability — job history, live now-analyzing, durations & metrics (0.84.0) (#6)
Some checks failed
deploy / test-backend (push) Failing after 19m59s
deploy / test-frontend (push) Successful in 9m54s
deploy / build-and-push (push) Has been skipped
deploy / deploy (push) Has been skipped

This commit was merged in pull request #6.
This commit is contained in:
2026-06-16 12:21:13 +00:00
parent 790549636f
commit d51ab2a049
41 changed files with 3655 additions and 21 deletions

View File

@@ -321,6 +321,10 @@ pub struct CrawlerConfig {
pub idle_timeout: Duration,
pub chapter_workers: usize,
pub retention_days: u32,
/// Days to keep `crawl_metrics` timing rows before reaping. `0`
/// disables the reaper. Defaults to 90 (volume is low — one row per
/// manga/chapter/pass, not per image). `CRAWL_METRICS_RETENTION_DAYS`.
pub metrics_retention_days: u32,
pub start_url: Option<String>,
pub rate_ms: u64,
pub cdn_host: Option<String>,
@@ -379,6 +383,7 @@ impl Default for CrawlerConfig {
idle_timeout: Duration::from_secs(600),
chapter_workers: 1,
retention_days: 7,
metrics_retention_days: 90,
start_url: None,
rate_ms: 1000,
cdn_host: None,
@@ -500,6 +505,7 @@ impl CrawlerConfig {
idle_timeout: Duration::from_secs(env_u64("CRAWLER_IDLE_TIMEOUT_S", 600)),
chapter_workers: env_u64("CRAWLER_CHAPTER_WORKERS", 1).max(1) as usize,
retention_days: env_u64("CRAWLER_JOB_RETENTION_DAYS", 7) as u32,
metrics_retention_days: env_u64("CRAWL_METRICS_RETENTION_DAYS", 90) as u32,
start_url,
rate_ms: env_u64("CRAWLER_RATE_MS", 1000),
cdn_host,
@@ -583,7 +589,7 @@ fn build_download_allowlist(
allow
}
fn env_u64(name: &str, default: u64) -> u64 {
pub(crate) fn env_u64(name: &str, default: u64) -> u64 {
std::env::var(name)
.ok()
.and_then(|s| s.parse().ok())