The plugin can POST session summaries (sessions, drivers, incidents) to a Data API after capture. You choose one endpoint via the plugin settings Data API field.
| Environment | Endpoint | Backend |
|---|---|---|
| Local dev | http://localhost:8080 |
Local Flask + SQLite (observability/local/data-api/) |
| Production | Your Cloudflare Worker URL | Cloudflare Worker + D1 |
Same contract both sides: POST /session-complete with SessionSummary JSON. Deterministic incident IDs make retries and backfill safe.
- Run the data-api container (or
python app.pyfromobservability/local/data-api/). - In the plugin settings, set Data API to
http://localhost:8080. - After session capture, the plugin POSTs to
http://localhost:8080/session-complete.
-
Prereqs: Node.js, Wrangler (
pnpm add -g wranglerorpnpx wrangler), Cloudflare account. -
Create the D1 database
cd worker npx wrangler d1 create simsteward-dbCopy the printed
database_id. -
Wire the database into the Worker
Editworker/wrangler.tomland setdatabase_idunder[[d1_databases]]to the value from step 2 (replaceREPLACE_AFTER_D1_CREATE). -
Apply the schema
npx wrangler d1 execute simsteward-db --remote --file=./schema.sql
For local D1 (e.g. tests): use
--localinstead of--remote. -
Deploy the Worker
npx wrangler deploy
Note the deployed URL (e.g.
https://simsteward-data.<account>.workers.dev). -
Configure the plugin
In SimHub → Sim Steward settings, set Data API to that Worker URL (no trailing slash). The plugin will POST to{url}/session-completeafter each session capture.
GET /health— returns{"status":"ok"}.POST /session-complete— body:SessionSummaryJSON (camelCase); same as local data-api. Returns200with{"ok":true,"sub_session_id":<id>}or400/500with{"error":"..."}.
Schema lives in worker/schema.sql (drivers, sessions, incidents, incident_captures). It matches the local data-api and the deterministic data point plan; incidents include optional fingerprint_version (1 = deterministic).