Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.
Python amdapple-siliconcudadeepseekexl3exllamav3glminferencellmllm-inferencelocal-llmnvidiaopenai-apiquantizationqwenrocmstrix-halo
Metrics: add llamacpp:prompt_tokens_total counter
Alex Nobert39f9cfa127db
diff --git a/tools/serve_metrics.py b/tools/serve_metrics.pyindex abbe04e..66f5a36 100644--- a/tools/serve_metrics.py+++ b/tools/serve_metrics.py@@ -9,6 +9,7 @@ from __future__ import annotations# (name, type, help) in the order the /metrics body renders them.METRICS = [+ ("llamacpp:prompt_tokens_total", "counter", "Total prompt tokens"),("llamacpp:prompt_tokens_cached_total", "counter", "Total prompt tokens reused from cache"),("llamacpp:prompt_seconds_total", "counter", "Prompt process time"),("llamacpp:tokens_predicted_total", "counter", "Total tokens generated"),@@ -34,6 +35,7 @@ class Metrics:"""Counters plus the last request's speeds, observed from the engine's eos event."""def __init__(self) -> None:+ self.prompt_tokens_total = 0.0self.prompt_cached_total = 0.0self.prompt_seconds_total = 0.0self.tokens_predicted_total = 0.0@@ -48,6 +50,7 @@ class Metrics:def observe(self, *, prompt_tokens: int, cached: int, predicted: int,prefill_s: float, generate_s: float,drafts: int = 0, draft_tokens: int = 0, accepted: int = 0) -> None:+ self.prompt_tokens_total += prompt_tokensself.prompt_cached_total += cachedself.prompt_seconds_total += prefill_sself.tokens_predicted_total += predicted@@ -63,6 +66,7 @@ class Metrics:def render(self, *, processing: int, deferred: int, kv_ratio: float) -> bytes:values = {+ "llamacpp:prompt_tokens_total": self.prompt_tokens_total,"llamacpp:prompt_tokens_cached_total": self.prompt_cached_total,"llamacpp:prompt_seconds_total": self.prompt_seconds_total,"llamacpp:tokens_predicted_total": self.tokens_predicted_total,@@ -88,6 +92,7 @@ def assert_reported(samples: dict, test, *, prompt_tokens: int, cached: int, preaccepted: int) -> None:"""unittest helper: rendered /metrics samples must match one observed request."""expected = {+ "llamacpp:prompt_tokens_total": prompt_tokens,"llamacpp:prompt_tokens_cached_total": cached,"llamacpp:prompt_seconds_total": prefill_s,"llamacpp:tokens_predicted_total": predicted,