Repository navigation
Conversation
Implement DS-002 with verified subject/service counters, JSON and SSE token usage, durable minute checkpoints, and fetch/commit/ACK delivery to server receipts. Add the local Python testbed, six acceptance scenarios, and ingress coverage. Keep quota enforcement outside this change.
Replace collector IDs with historical Gateway and replica identities. Consolidate the unapplied usage migration into two tables, preserve legacy checkpoint and API compatibility, and cover replay, persistence, multi-replica collection, and migration behavior. Include the local Gateway configuration retry increase from 50 to 300. Validation: 204 tests passed, 1 opt-in real-minute test skipped; local Nginx and PostgreSQL checks enabled. Ruff and formatting checks passed for all 18 changed files.
Keep serving requests and the management connection alive during retirement. Seal the final minute and require a durable ACK before terminating the VM so another server can replay a committed batch after lease takeover.
Use numbered user/run rows to enforce delivery keys and verify full batch replays. Keep page writes atomic and acknowledge only committed batches.
Author
|
сlosed |
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.
Problem
Operators need to measure usage for every inference request routed through dstack and retain enough data to calculate costs by user and service.
Solution
Add Gateway metering for OpenAI-compatible API requests. Count output tokens and record total and cached prompt tokens to calculate the cache hit rate. Define how to count requests when they are retried or streams are interrupted. Store per-minute totals by user and service in a queryable table.