mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
feat(monitoring): add stats counters API and public status page
Add GET /api/stats exposing cumulative counters (feeds created/deleted, emails received/rejected, recent date-times) plus live values (active feeds, active WebSub subscriptions). Counters persist in a stats:counters KV singleton and are incremented at the email-processing chokepoint and feed create/delete paths. Replace the / → /admin redirect with a public status page rendering these figures with a link to the admin. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,23 @@ export interface FeedListItem {
|
||||
expires_at?: number; // Cached from FeedConfig to avoid per-feed KV reads
|
||||
}
|
||||
|
||||
// Cumulative monitoring counters (persisted as a KV singleton)
|
||||
export interface Counters {
|
||||
feeds_created: number;
|
||||
feeds_deleted: number;
|
||||
emails_received: number;
|
||||
emails_rejected: number;
|
||||
last_email_at?: string; // ISO 8601
|
||||
last_feed_created_at?: string; // ISO 8601
|
||||
first_seen?: string; // ISO 8601 — first time counters were written (instance start)
|
||||
}
|
||||
|
||||
// Monitoring API response: persisted counters + live-computed values
|
||||
export interface StatsResponse extends Counters {
|
||||
active_feeds: number;
|
||||
websub_subscriptions_active: number;
|
||||
}
|
||||
|
||||
// WebSub (PubSubHubbub) subscription configuration
|
||||
export interface WebSubSubscription {
|
||||
callbackUrl: string;
|
||||
|
||||
Reference in New Issue
Block a user