Skip to content

feat(loops): add truss loops metrics command - #2468

Open
rcano-baseten wants to merge 3 commits into
mainfrom
rcano/loops-metrics-cli
Open

feat(loops): add truss loops metrics command#2468
rcano-baseten wants to merge 3 commits into
mainfrom
rcano/loops-metrics-cli

Conversation

@rcano-baseten

Copy link
Copy Markdown
Contributor

Summary

Adds `truss loops metrics --deployment-id ` (and `--base-model ` as a convenience selector) so users can see how their Loops trainer deployments are performing without leaving the CLI. Prints a service-level table (request rate, concurrent requests, latency p50/p95/p99, rate by 2xx/4xx/5xx) and a per-node compute table (CPU cores, CPU mem, GPU util/mem per rank, ephemeral storage utilization) using `rich`.

Pairs with backend PR https://github.com/basetenlabs/baseten/pull/20094 which adds `POST /v1/loops/deployments//metrics` and the parallel GraphQL query.

Test plan

  • `uv run pytest truss/tests/cli/test_loops_cli.py` — 45 passed (6 new metrics tests + existing suite)
  • `uv run ruff check` + `uv run ruff format` clean on touched files
  • End-to-end against local stack once the backend PR lands: `truss loops push --remote=baseten-local`, then `truss loops metrics --base-model --remote=baseten-local` — verify the snapshot prints sane values

🤖 Generated with Claude Code

Surfaces compute utilization (GPU/CPU/memory) and Knative queue-proxy
request metrics (rate, concurrent requests, latency p50/p95/p99, rate by
status class) for a Loops trainer deployment. Pass --deployment-id or
--base-model to identify the deployment; the latter resolves to the
caller's active deployment for that model and errors on zero or multiple
matches.

Backend buddy PR adds POST /v1/loops/deployments/<id>/metrics.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CLAassistant

CLAassistant commented May 16, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

rcano-baseten and others added 2 commits May 18, 2026 11:08
…me_stats)

Matches the backend rename from `request_rate`/`request_latencies` to
`inference_volume`/`response_time_stats` so trainer metrics nomenclature stays
consistent with the oracle/inference surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backend PR clarified that response_time_stats values are milliseconds (matches
the queue-proxy histogram bucket unit and the oracle response_time_stats
convention). Updating the CLI labels from "(s)" to "(ms)" so the displayed
header matches the value scale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants