-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usage-based reporting & billing v2 #1123
Conversation
540ae50
to
6c2d85f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
6c2d85f
to
fbc7ae1
Compare
Add a new ops.Stats.Interval sub-message, which is written out at fixed wall-time intervals (every 3 minutes, currently) for each task. Interval models task uptime and a "usage rate" concept. In the future it could also model current disk usage and other sampled metrics. Issue #1122
The L1 reporting derivation calculates a `usageSeconds` statsSummary metric as the product of `uptimeSeconds` and `usageRate`. `uptimeSeconds` and `usageSeconds` are aggregated at each of our reporting grains, and `usage_seconds` is a materialized column of our `catalog_stats` table. Issue #1122
* Add `usage_seconds` as a `catalog_stats` column, and partition `catalog_stats` on grain. * Add `data_tiers`, `usage_tiers`, and `recurring_usd_cents` to `tenants` table. * Add an internal `billing_adjustments` table. * Add a `billing_report_202308` RPC which implements the new billing logic, with accompanying tests. Issue #1122
fbc7ae1
to
9547fdb
Compare
After a conversation with @psFried on the future of control-plane DB migrations, I've re-worked the supabase changes into a more traditional DB migration (alter existing tables, rather than derive a separate diff). That's particularly important here because I've got it re-building the I've locally tested the migration and release of this feature, starting with running tasks and a populated
Rebuilding the |
Introduce interval stats for measuring fine-grain task usage. Update our reporting to roll them up, and introduce a new billing report which implements our updated pricing logic.
This PR implements all idealized changes for how reporting and billing will work.
I still need to work up a production DB migration, but I'd like to review first.
Workflow steps:
This PR adds a new
billing_report_202308
(post-fix encodes the effective date-month for the report).We'll need to transition the UI over to calling it.
Checkout out
billing.test.sql
for elaborate examples of what the output report looks like.Here's an example from my local stack:
Documentation links affected:
(list any documentation links that you created, or existing ones that you've identified as needing updates, along with a brief description)
Notes for reviewers:
Please review commit-by-commit.
Issue #1122
This change is