Repository navigation
feat(api,cli,mcp): usage metering v1 — per-project aggregates - #99
Merged
Merged
Conversation
Deployments now record artifact_bytes (static output dir size at build
completion, covers local/remote/KERN paths) and image_bytes (built image
size for dockerfile deploys) into deployment.config. Build seconds come
from existing timestamps.
- GET /api/v1/projects/{id}/usage?days=N (1-365, default 30): deploy
counts, succeeded/failed, build_seconds, artifact_bytes, image_bytes
- runway usage [--days N] [--json]
- MCP get_project_usage
- fmt_bytes shows sub-KB values as B
Verified live: bitbucket webhook deploy records artifact_bytes, REST +
MCP + CLI all return the aggregate.
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Mira PR WalkthroughAdds usage metering v1 across the API, worker, CLI, and MCP surfaces: workers record artifact/image byte sizes at build completion, the API exposes a per-project usage aggregate over a configurable day window, and both the CLI and MCP tool expose that same aggregate. The change is cross-cutting but narrowly scoped to a read-only reporting path plus two new metrics captured during deployment builds. graph LR
worker["crates/worker/src/deploy.rs"] --> apiProjects["crates/api/src/routes/projects.rs"]
apiLib["crates/api/src/lib.rs"] --> apiProjects
apiMcp["crates/api/src/routes/mcp.rs"] --> apiProjects
cliCommands["crates/cli/src/commands.rs"] --> apiProjects
cliMain["crates/cli/src/main.rs"] --> cliCommands
❌ Review failed — click for detailsThe code review failed to complete due to an unexpected error. Stage: Code review
|
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.
Summary
GET /api/v1/projects/{id}/usage?days=N— deploy counts, build seconds, artifact/image bytes (1–365d window)runway usage [--days N] [--json]CLI commandget_project_usageMCP tool (same aggregate, shared fn)artifact_bytes(static output dir size — covers local, remote-node, and KERN artifact paths) andimage_bytes(docker inspect on the built image) intodeployment.configat build completionVerification
artifact_bytes: 147; REST, MCP JSON-RPC, and CLI all return the aggregatecargo fmt,cargo clippy --workspace -- -D warnings,cargo testcleanTest plan
tools/call get_project_usagerunway usage+runway usage --jsonGenerated with Devin