Skip to content
InsightFlarePublic

About

Open-source performance reporting and diagnostics for InsightFlare

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

InsightFlare Pulse

Open-source performance reporting receiver for InsightFlare. Hono + Cloudflare Workers + D1, MIT licensed.

Scope

The public POST /api/v1/reports endpoint accepts the current InsightFlare Performance Report V1 schema. No client authentication, signing, source keys, or registration. Instance IDs and Git SHAs are claims, not verified identities. Reports are untrusted. First accepted report wins for a claimed instance/date; spoofing and Sybil attacks remain possible.

The server validates payloads against code-owned route/query/diagnostic vocabularies, limits streamed request bodies to 128 KiB, accepts only the previous three completed UTC days, and uses atomic D1 admission limits (500 reports, 100 new identities, 8 MiB of request bodies per UTC day). The new-identity count is relative to retained reports. D1 limits protect accepted writes, not total requests or failed database operations. Cloudflare rate-limit bindings are regional and approximate. Configure edge WAF separately for production. No IP or incoming headers are stored; platform observability is disabled by default.

The admin API requires a separately configured ADMIN_TOKEN of at least 32 characters. Do not expose individual reports publicly. GET /api/admin/summary?date=YYYY-MM-DD returns report-level P95 medians per historical build, excludes internally inconsistent or insufficient samples and flags statistical outliers in cohorts of at least ten; includeOutliers=1 restores statistically flagged samples. This is not a global request P95 or proof of authenticity. GET /api/admin/reports and GET /api/admin/reports/:instance/:date provide bounded inspection.

Raw reports are retained for 14 days; hourly bounded cleanup. The protected analysis API provides instance history, observed main-commit indexing, paired build/endpoint comparison, resource metrics, SQL hotspots, error samples and DO snapshots. See analysis API for coverage, filtering and query limits. A private-data dashboard is served at /app/ by the same Worker, with no additional database tables. Durable aggregation remains a later milestone.

Local development

Requires Node.js 24 and pnpm. Run pnpm install, pnpm check, pnpm test, pnpm test:workerd, pnpm db:local, then pnpm dev. In a local ignored .dev.vars file set INGEST_ENABLED=1 and ADMIN_TOKEN to a random secret (at least 32 characters). The checked-in database ID is a placeholder, production ingestion is off and workers.dev/preview URLs are disabled. Create a real D1 binding, set a secret with wrangler, configure a custom domain and WAF, apply remote migrations explicitly and only enable ingestion after end-to-end acceptance. No remote data is used in tests.

Protocol

src/protocol is a versioned snapshot from the InsightFlare sender's current V1 development worktree (base 06df1029). Route keys were extracted from actual Hono route registrations, query IDs from the actual query registry, and safe diagnostic decoding and schema from the sender. Snapshot must be synchronized when the sender changes; a shared versioned protocol package is a future improvement. No production credentials or reports are included.

Dashboard

Open /app/ on the local Worker after configuring ADMIN_TOKEN. The login shell and hashed static assets are public; all diagnostic data and admission budget APIs require the administrator bearer token. The token remains in React session memory, is not persisted in localStorage, sessionStorage, cookies or URLs, and must be entered again after reload. Sign-out cancels queries and clears the query cache. Use HTTPS in production; a Cloudflare Access policy restricted to the management page and APIs is recommended as an additional layer, not enabled by this repository. Never protect the public reporting endpoint with that policy.

The frontend uses the published @insightflare/ui package, React, TanStack Router and Query, Vite and Tailwind. It is a static application served via Workers Assets, not TanStack Start SSR. No private data is included in the build. pnpm dev and pnpm deploy build the assets first. The repository does not contain a production database ID or a production token.

Pages: Overview, Builds, Endpoints, SQL hotspots, Errors, Durable Objects, Instances, Reports and Ingestion. Date filters use UTC; comparisons pair matching claimed UUIDs, and the dashboard preserves the analysis API's sample and coverage limitations. Admission settings are read-only; change deployment variables to change receiver behavior.

Run pnpm exec playwright install chromium and pnpm test:browser to run a real local Worker/D1/Chromium test with synthetic reports. The CI runs this test as well as unit tests and frontend/backend type checks. For Windows systems with a compatible installed Edge browser, set PULSE_BROWSER_CHANNEL=msedge if needed.

About

Open-source performance reporting and diagnostics for InsightFlare

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages