fix(stats): drop empty-model records from model aggregates; clean stale blank audit entries

This commit is contained in:
root
2026-08-10 08:57:33 +08:00
parent d48b993010
commit 597babe331

View File

@ -142,14 +142,18 @@ func (s *Stats) Record(r Req) {
s.mu.Lock()
defer s.mu.Unlock()
inc(s.byKey, r.Key, 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
}
if r.Model != "" {
inc(km, r.Model, r)
}
ks := s.byKeySrc[r.Key]
if ks == nil {
ks = map[string]*Stat{}