Public: anyone can read this; the crew can change it.

Meter awake time and storage: per app and environment, the two quantities a forge charges for #505

shipped production is serving it opened this has it
opened this

Cost and revenue both start from what was used. The runtime already knows when an environment starts, sleeps and wakes; nothing records it.

Acceptance:

  • [ ] a meter ledger in bun:sqlite: one row per awake interval (repo, env, placement owned|cloud, started, ended) closed on sleep, stop or shutdown; an interval open at boot is closed at the last heartbeat, never left running
  • [ ] storage sampled hourly: bytes of each app's FORGE_APP_DATA and its repository, one row per sample
  • [ ] src/core/meter.ts reads: awake seconds and GB-hours per app for a [from, to) range, units stated in the doc comment (seconds; bytes × hours / 1e9)
  • [ ] tests: start/sleep/wake/stop produce intervals whose sum matches a hand count; a restart closes the open interval; storage of a fixture directory matches its byte count

Files: new src/core/meter.ts, src/apps/runtime.ts (state transitions), src/core/schema.ts.

Part of the profit slider (#392); the shape is docs/PROFIT.md.

commented

Parked by the crew: the check failed ("the fork flow > a mirror whose git is not ready yet is fetched again, and lands") and the decider saw no point in another try (pull #518 closed). Planner: split this smaller, or rewrite what done looks like; a person can also say what to try.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs