Uh oh!
There was an error while loading. Please reload this page.
metrics for usage tracking - #24
Conversation
dixitaniket
commented
Jun 9, 2026
- pushes important metrics to supabase
There was a problem hiding this comment.
Pull request overview
Adds aggregate inference-usage tracking to the facilitator by accepting optional usageMetadata on /settle, persisting rollups in Redis, and optionally forwarding aggregates to a Supabase RPC for centralized reporting.
Changes:
- Accepts and enqueues optional
usageMetadataalongside payment settlement jobs. - Introduces a Redis-backed usage rollup tracker with optional Supabase RPC sink and a new
/usagestats endpoint. - Adds README environment variables for configuring the Supabase usage sink.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents env vars for enabling/disabling Supabase usage sink and configuring the RPC. |
| payment_worker.ts | Records usage metadata after successful payment settlement and closes the usage tracker on shutdown. |
| all_networks.ts | Parses usageMetadata in /settle, passes it into the payment job, adds /usage endpoint, and closes tracker on shutdown. |
| all_networks_usage.ts | New module implementing Redis rollups, dedupe, optional Supabase RPC forwarding, stats retrieval, and graceful shutdown. |
| all_networks_types_helpers.ts | Adds InferenceUsageMetadata type and parsing/validation helper for request bodies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.