mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(metrics): fold provenance into account batch, pin no-store output
Provenance counters now ride the accountWith batch. They no longer use a separate droppable async write, so a request costs the same number of store round trips as before. A golden file pins the full no-store scrape body. It was captured at the base commit, so any change to the no-store output fails the test. A partial store failure test shows that a failed family read latches the store and skips later reads in the same scrape. The README notes the rollout-day stream label and the removal of rejection series.
This commit is contained in:
+3
-5
@@ -158,9 +158,7 @@ func TestRoundTrips_SingleGroupChat_Defaults_TwoSyncOneAsync(t *testing.T) {
|
||||
// this is a SEPARATE async call, not a batch this one rides. 2 sync + 2
|
||||
// async = 4 total, once per admitted request from a scope l.lastSeen.due
|
||||
// has not already throttled within lastSeenGateThrottle (60s) — a fresh
|
||||
// limiter's first request for a scope, as this test drives. With metrics
|
||||
// on and a store, the usage-provenance mirror (countProvenanceShared) adds a
|
||||
// fifth, async round trip.
|
||||
// limiter's first request for a scope, as this test drives.
|
||||
func TestRoundTrips_SingleGroupChat_AllStatsOn_NoNewSyncRoundTrips(t *testing.T) {
|
||||
srv := roundTripTestUpstream(t)
|
||||
gw, counting := buildRoundTripTestGateway(t, srv, func(cfg *Config) {
|
||||
@@ -176,8 +174,8 @@ func TestRoundTrips_SingleGroupChat_AllStatsOn_NoNewSyncRoundTrips(t *testing.T)
|
||||
|
||||
got := counting.total()
|
||||
t.Logf("AFTER (admin.stats.userModel=true, admin.stats.latency=true, metrics on, no cache): %d counterStore round trips for the SAME single-group chat request", got)
|
||||
if got != 5 {
|
||||
t.Errorf("round trips with all stats on = %d, want 5 (2 sync + 3 async: checkAndCount, accountWith, recordProviderAttempt, recordLastSeen, provenance) — every new counter family rides an EXISTING sync batch except last-seen and, with metrics on, provenance, which are their own async writes by design", got)
|
||||
if got != 4 {
|
||||
t.Errorf("round trips with all stats on = %d, want 4 (2 sync + 2 async: checkAndCount, accountWith, recordProviderAttempt, recordLastSeen) — every new counter family rides an EXISTING sync batch except last-seen, which is its own async write by design (P9 fix)", got)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user