From 597babe331737037de9cc767ded2e3f11c7f8e59 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 10 Aug 2026 08:57:33 +0800 Subject: [PATCH] fix(stats): drop empty-model records from model aggregates; clean stale blank audit entries --- internal/gateway/stats.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/gateway/stats.go b/internal/gateway/stats.go index aefb263..5f8cfc1 100644 --- a/internal/gateway/stats.go +++ b/internal/gateway/stats.go @@ -142,14 +142,18 @@ func (s *Stats) Record(r Req) { s.mu.Lock() defer s.mu.Unlock() inc(s.byKey, r.Key, r) - inc(s.byModel, r.Model, r) + if r.Model != "" { + inc(s.byModel, r.Model, r) + } inc(s.bySrc, r.Source, r) km := s.byKeyModel[r.Key] if km == nil { km = map[string]*Stat{} s.byKeyModel[r.Key] = km } - inc(km, r.Model, r) + if r.Model != "" { + inc(km, r.Model, r) + } ks := s.byKeySrc[r.Key] if ks == nil { ks = map[string]*Stat{}