mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-10-12 04:54:45 +00:00
Add exerciseLatencyMetrics, proving the new upstream-latency histograms render correctly under the real Yaegi interpreter, not merely that a compiled go test accepts the same bytes. Compiled tests have repeatedly passed on this codebase while the interpreted shape failed, which is exactly what this probe caught: two bugs in the core feature commit, found and fixed only because this harness exists. Parse the rendered body with prometheus/common/expfmt's real TextParser, the same library a real Prometheus server's scrape loop uses, instead of this project's own hand-rolled parser. A malformed histogram fails to parse outright under a real parser, matching the failure mode a live scrape target actually hits, rather than merely failing one hand-written assertion. No new traffic is driven here: the existing exerciseAttemptAccounting sub-probe already posts one real, non-streaming chat completion against the openai provider, so the duration histogram already carries a real observation by the time this probe runs. Add github.com/prometheus/common/expfmt as a dependency of this harness module only, isolated from the plugin's own stdlib-only go.mod by design (this package's own doc comment). Go raised this module's go directive from 1.22 to 1.25.0 to satisfy the new dependency; the plugin module itself is untouched.