feat: expand shusub2 log metrics

This commit is contained in:
2026-07-27 20:50:55 +08:00
parent b248a6c9c1
commit 4d8d117fb1
5 changed files with 83 additions and 22 deletions
+8 -7
View File
@@ -94,7 +94,7 @@ horizontally instead of truncating a field:
```text
ACCOUNT | Group | Today | Daily | 5h | 7d | Avail
KEY | Today | Tokens | Req
LOG KEY | Account | Model | Cost | Latency | Time | Age
LOG KEY | Account | Model | First | Duration | Tok/s | Input | Output | Cache | Tokens | Cost | Time | Age
ERR | Status | Key | Account | Model | Time | Age
```
@@ -116,7 +116,7 @@ Sub2API admin usage API and refreshes every 60 seconds by default
(`--logs-refresh-seconds` / `SHUSUB2_LOGS_REFRESH_SECONDS`). Columns:
```text
Key | Account | Model | Effort | Type | Tokens | Cost | First | Latency | Tok/s | Time | Age
Key | Account | Model | Effort | Type | Input | Output | Cache | Tokens | Cost | First | Duration | Tok/s | Time | Age
```
`Type` is the Sub2API `request_type` (`sync` / `stream` / `ws_v2` / `cyber`).
@@ -125,11 +125,12 @@ the table shows the per-bucket breakdown, actual cost, first-token latency,
decode speed, upstream model mapping, user, and request id.
`Effort` is the request's `reasoning_effort` (`-` when absent). `First` is the
first-token latency and `Latency` the total duration, both shown in seconds.
`Tok/s` is the decode throughput computed as
`output_tokens / (latency - first_token)`; it shows
`-` when there is no output or no positive decode window. `Age` is relative to
local current time (`now`, `5m ago`, `2h ago`, etc.). In the TUI each
first-token latency and `Duration` the total request time, both shown in
seconds. `Tok/s` is the decode throughput computed as
`output_tokens / (duration - first_token)`; it shows `-` when there is no
output or no positive decode window. `Input`, `Output`, and `Cache` are token
buckets; `Cache` combines cache write and cache read. `Tokens` is their total.
`Age` is relative to local current time (`now`, `5m ago`, `2h ago`, etc.). In the TUI each
API key name is rendered in a stable per-key color so rows from the same
key are easy to group visually (`--once --logs` output stays plain text).