Skip to content

engines: show n/a, not 0.0, for metrics an engine never reported - #146

Merged
T-Crypt merged 7 commits into
mainfrom
T-Crypt/engine-metrics-unreported
Oct 22, 2026
Merged

T-Crypt merged 7 commits into
mainfrom
T-Crypt/engine-metrics-unreported

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Fixes #140, reported by @azrael-229.

Problem

llama-swap starts its llama-server without --metrics, so each upstream's /metrics answers 501. The reader's counters stayed at zero, rates() reported 0 decode and prefill, and the harbor's engine card drew (eng.decode_tps || 0).toFixed(1). A figure the engine never sent read as a measured zero, while the node's own request log showed 14.5 t/s for the same engine.

Change

  • proto.Engine.MetricsReported (metrics_reported, additive): true only when this read got real counters. The llama.cpp family, llama-swap upstreams, Strata, the Prometheus readers, FreeToken and the custom map set it. Every existing field is unchanged.
  • Harbor engine card: decode, prefill and the token totals render n/a through the existing na() helper when the flag is false; a reported zero still prints 0.0. A model row without reported VRAM reads ready n/a.
  • berth status: DECODE and PREFILL print - when unreported.
  • contrib/INTEGRATION.md: llama-swap's counters need --metrics on the model's llama-server.

Proof

  • TestLlamaSwapWithoutMetrics: a fake llama-swap whose upstream answers the real 501 body. The engine stays up with its model, and the counters read unreported.
  • Every counter reader's test asserts the flag. They fail without the readers' changes and pass with them.
  • Card rendering, run in Node: ready n/a and loaded 5.0G. The first draft rendered readyn/a, fixed in c6b443e.
  • build, gofmt, vet, go test ./..., Windows build and vet, golangci-lint (0 issues), node --check on every harbor script.

Not proven live: a llama-swap started with --metrics, because that needs an engine restart.

Out of scope, as a follow-up: when an engine reports no counters, fall back to the node's own request log for decode.

An engine that never answered its counters endpoint reads a zero rate,
and the harbor draws that zero as measured. Add the field and assert
what each reader must set; every true case fails until the readers
fill it.
The llama.cpp family, llama-swap upstreams, strata, the Prometheus
readers and FreeToken now set metrics_reported on a read that actually
got counters, so a zero rate is distinguishable from silence.
An engine that never answered its counters endpoint (llama-swap without
--metrics on its llama-server) drew DECODE 0.0 t/s and zero token
totals. With metrics_reported false, decode, prefill and the token
totals render n/a, model rows show n/a where per-model VRAM is absent,
and a reported zero still prints as 0.0. The demo fixture marks the
llama-swap card as reporting so the card reads live.
DECODE and PREFILL in the ENGINE table are unknown, not zero, when
metrics_reported is false.
Without it the reader gets a 501 per upstream and the card shows n/a.
CHANGELOG entry credits @azrael-229 and links #140.
@T-Crypt
T-Crypt merged commit de71c5a into main Oct 22, 2026
2 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/engine-metrics-unreported branch October 22, 2026 13:59
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.

engines tab: engine card shows all-zero metrics for a busy llama-swap model; unreported reads as zero

1 participant