Files
llmgw/internal/router/scrape/strata_test.go
T
Ilker ManapandClaude Opus 5.5 1908bfb4b2 Strata on cuda01 end to end: its engine is the shard's, its metrics read
Found running it through the cluster:

- Strata's server starts its engine in a process group of its own, so the
  agent saw a GPU replica on the CPU and its 22 GB as somebody else's
  memory. A process the shard started, at any remove, is now the shard's.
- An adopted shard's kept compute was sent at once and never again, so a
  wrong one read again on adoption never reached the control plane: what
  is sent is sent again when it changes, and a GPU shard kept as the CPU
  is read again on adoption.
- /metrics/prometheus is llama.cpp's names without the KV cache; vLLM's,
  with it, are /metrics?format=prometheus. The router now sees running 1,
  waiting 2 under load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 15:48:15 +01:00

39 lines
1.2 KiB
Go

package scrape
import (
"strings"
"testing"
)
// strataSample is Strata 0.2.7's /metrics?format=prometheus, cut down, as
// cuda01 served it: vLLM's names beside its own.
const strataSample = `# TYPE vllm:num_requests_running gauge
vllm:num_requests_running{model_name="qwen3.8-flash-next"} 1
# TYPE vllm:num_requests_waiting gauge
vllm:num_requests_waiting{model_name="qwen3.8-flash-next"} 3
# TYPE vllm:kv_cache_usage_perc gauge
vllm:kv_cache_usage_perc{model_name="qwen3.8-flash-next"} 0.25
# TYPE vllm:prompt_tokens_total counter
vllm:prompt_tokens_total{model_name="qwen3.8-flash-next"} 4826
# TYPE vllm:generation_tokens_total counter
vllm:generation_tokens_total{model_name="qwen3.8-flash-next"} 1979
# TYPE strata:live_tok_s gauge
strata:live_tok_s 0
`
func TestStrataIsReadInVLLMsNamesFromItsPrometheusFormat(t *testing.T) {
m := MappingFor("strata")
// Plain /metrics is JSON, and /metrics/prometheus has llama.cpp's
// names without the KV cache: read there, Strata was unmeasured.
if m.Path != "/metrics?format=prometheus" {
t.Errorf("read at %q", m.Path)
}
s, err := Parse(strings.NewReader(strataSample), m)
if err != nil {
t.Fatal(err)
}
if s.Running != 1 || s.Waiting != 3 || s.KVCacheUsage != 0.25 {
t.Errorf("stats %+v", s)
}
}