feat(billing): Deploy spend-cap detection and budget alerts (ENG-2904)#6486
Draft
Flo4604 wants to merge 1 commit into
Draft
feat(billing): Deploy spend-cap detection and budget alerts (ENG-2904)#6486Flo4604 wants to merge 1 commit into
Flo4604 wants to merge 1 commit into
Conversation
Contributor
This was referenced Jun 18, 2026
Member
Author
6146962 to
685ad22
Compare
685ad22 to
b26245b
Compare
47b4108 to
9bc8171
Compare
b26245b to
7688166
Compare
7de9c43 to
0d1dceb
Compare
46cb18d to
5d9c0c3
Compare
0d1dceb to
61a1310
Compare
5d9c0c3 to
60536d9
Compare
61a1310 to
676ae6a
Compare
60536d9 to
b8cef3f
Compare
676ae6a to
ecead5f
Compare
b8cef3f to
c963735
Compare
ecead5f to
6bc0aad
Compare
c963735 to
edea2d1
Compare
6bc0aad to
dbea64a
Compare
edea2d1 to
c2fb151
Compare
dbea64a to
39ef825
Compare
c2fb151 to
b7d22e7
Compare
39ef825 to
5abc9c8
Compare
b7d22e7 to
dd7c886
Compare
5abc9c8 to
53a4868
Compare
dd7c886 to
393c67f
Compare
This was referenced Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Emails workspace admins at 50/75/100% of Compute spend budget. ENG-2869 stored the settings. This PR reads them and sends alerts. Enforcement (stopping compute at 100%) is ENG-2923.
deploy_spend_budget_stopis carried through and only logged here.A
deploy-spend-checkcron firesCronService.RunDeploySpendCheck. Local dev runs every minute (dev/k8s/charts/restate-cronjobs/values.yaml). Production cadence (15 minutes) lands in the infra repo.The orchestrator lists workspaces with a budget, prices month-to-date usage from one grouped ClickHouse scan, computes overage = max(0, gross − included credit), and fans out
DeploySpendCheckService.CheckWorkspaceSpendfor workspaces at or past the lowest alert threshold. Included credit comes fromdeploy_included_credit_cents(dashboard webhook oninvoice.payment_succeeded).Also adds dashboard
deployPricing.ts,deployCreditstests, and orchestrator integration coverage. The full suspend/resume integration test (deploy_spend_check_test) needsDeployTeardownServiceand lands on ENG-2923 (#6542), not this PR.Closes ENG-2904. Stacked on ENG-2908 (#6456).
Local setup
Optional alert emails:
dev/.env.workos,dev/.env.resend.Test plan
Trigger spend check without waiting for cron:
curl -X POST "http://localhost:8080/hydra.v1.CronService/$(date -u +%Y-%m)/RunDeploySpendCheck/send"End-to-end: subscribe to Deploy, set a spend budget, drive usage past 50% beyond included credit, wait ~1 minute or curl above, confirm alert email if Resend/WorkOS configured.