mirror of
https://gitcode.com/JianFeeeee/ModelRouter.git
synced 2026-09-20 00:48:00 +00:00
fix(stats): drop empty-model records from model aggregates; clean stale blank audit entries
This commit is contained in:
@ -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{}
|
||||
|
||||
Reference in New Issue
Block a user