[WIP] feat(e2b): add dimension-aware API key quota#565
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #565 +/- ##
==========================================
- Coverage 79.82% 79.32% -0.50%
==========================================
Files 202 211 +9
Lines 14791 16209 +1418
==========================================
+ Hits 11807 12858 +1051
- Misses 2553 2821 +268
- Partials 431 530 +99
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
66b42c2 to
ad19bc4
Compare
Implement Redis-backed API key quota enforcement for sandbox count, CPU, and memory dimensions across E2B admission and sandbox-manager create paths. Add quota storage, live accounting, anti-drift reconciliation, fail-open breaker behavior, metrics, config wiring, and focused unit coverage. Fold in follow-up hardening for malformed key rows, failed admission release, delete-event release, resource footprint calculation, Redis breaker behavior, and leadership-loss event writes. Signed-off-by: AiRanthem <zhongtianyun.zty@alibaba-inc.com> � Conflicts: � pkg/sandbox-manager/infra/sandboxcr/clone_test.go � pkg/servers/e2b/create.go � pkg/servers/e2b/create_test.go
ad19bc4 to
2117df0
Compare
Summary
Impact
This lets sandbox-manager reject over-quota API key usage before creating new sandbox resources, while keeping the quota implementation scoped to the E2B API and sandbox-manager layers.
Validation
GOCACHE=/private/tmp/go-build-cache /Users/sophon/Bin/go test ./pkg/cache ./pkg/sandbox-manager ./pkg/sandbox-manager/infra/sandboxcr ./pkg/servers/e2b ./pkg/servers/e2b/keys ./pkg/servers/e2b/models ./pkg/servers/e2b/quota