gitflarePublicPartly agent-ready50
cf-d1-queues-pulse
Event analytics on Cloudflare D1 and Queues: ingestion API, batched consumer, rollups, live dashboard, load generator, dead-letter view.
- LicenseApache-2.0
- LanguageTypeScript
- Last landed
8a65841Oct 20, 2026
Build the full D1 + Queues pulse app: dashboard, load generator, dead letters, percentiles, docs
8a65841import type { PulseEvent } from "./validate"; export interface RollupRow { minute: number; type: string; path: string; country: string; count: number; sum: number } export function aggregate(events: PulseEvent[]): RollupRow[] { const m = new Map<string, RollupRow>(); for (const e of events) { const minute = Math.floor(e.ts / 60000); const k = JSON.stringify([minute, e.type, e.path, e.country]); const row = m.get(k); if (row) { row.count++; row.sum += e.value; } else m.set(k, { minute, type: e.type, path: e.path, country: e.country, count: 1, sum: e.value }); } return [...m.values()];}