add worker event tracking; implement worker rates display in admin panel
This commit is contained in:
+16
-1
@@ -432,7 +432,22 @@ async function adminRoutes(fastify) {
|
||||
FROM articles GROUP BY content_status ORDER BY n DESC
|
||||
`).all();
|
||||
|
||||
return { total, withContent, withEmbedding, eventCount, bySource, byStatus };
|
||||
const ingestedPerHour = db.prepare(`
|
||||
SELECT COUNT(*) as n FROM articles WHERE ingested_at >= datetime('now', '-1 hour')
|
||||
`).get().n;
|
||||
|
||||
const contentPerHour = db.prepare(`
|
||||
SELECT COUNT(*) as n FROM articles WHERE content_attempted_at >= datetime('now', '-1 hour')
|
||||
`).get().n;
|
||||
|
||||
let embeddingsPerHour = 0;
|
||||
try {
|
||||
embeddingsPerHour = db.prepare(`
|
||||
SELECT COUNT(*) as n FROM article_embedding_meta WHERE embedded_at >= datetime('now', '-1 hour')
|
||||
`).get().n;
|
||||
} catch (_) {}
|
||||
|
||||
return { total, withContent, withEmbedding, eventCount, bySource, byStatus, ingestedPerHour, contentPerHour, embeddingsPerHour };
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user