feat(admin): observability — job history, live now-analyzing, durations & metrics (0.84.0) (#6)
This commit was merged in pull request #6.
This commit is contained in:
@@ -157,6 +157,46 @@ pub struct PageStatusItem {
|
||||
pub status: String,
|
||||
}
|
||||
|
||||
/// One row in the admin analysis-history table: a completed or failed
|
||||
/// analysis pass resolved to its page/chapter/manga context. Sourced from
|
||||
/// the persistent `page_analysis` table (not the reaped job queue), so it
|
||||
/// survives indefinitely. `status` is `done` | `failed`.
|
||||
#[derive(Debug, Clone, Serialize, FromRow)]
|
||||
pub struct AnalysisHistoryRow {
|
||||
pub page_id: Uuid,
|
||||
pub page_number: i32,
|
||||
pub chapter_id: Uuid,
|
||||
pub chapter_number: i32,
|
||||
pub manga_id: Uuid,
|
||||
pub manga_title: String,
|
||||
pub status: String,
|
||||
pub is_nsfw: bool,
|
||||
pub model: Option<String>,
|
||||
pub error: Option<String>,
|
||||
pub analyzed_at: Option<DateTime<Utc>>,
|
||||
/// Wall-clock the worker spent on this page; `None` for rows analyzed
|
||||
/// before duration tracking landed.
|
||||
pub duration_ms: Option<i64>,
|
||||
}
|
||||
|
||||
/// Per-model average analysis duration (admin Metrics tab).
|
||||
#[derive(Debug, Clone, Serialize, FromRow)]
|
||||
pub struct ModelDuration {
|
||||
pub model: Option<String>,
|
||||
pub avg_ms: Option<f64>,
|
||||
pub n: i64,
|
||||
}
|
||||
|
||||
/// Aggregate analysis timing/outcome roll-up over a time window.
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct AnalysisMetrics {
|
||||
pub n: i64,
|
||||
pub ok: i64,
|
||||
pub failed: i64,
|
||||
pub avg_ms: Option<f64>,
|
||||
pub by_model: Vec<ModelDuration>,
|
||||
}
|
||||
|
||||
/// One OCR line in the page-detail view.
|
||||
#[derive(Debug, Clone, Serialize, FromRow)]
|
||||
pub struct OcrLine {
|
||||
|
||||
Reference in New Issue
Block a user