mirror of
https://gitcode.com/JianFeeeee/ModelRouter.git
synced 2026-09-20 08:57:57 +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()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
inc(s.byKey, r.Key, r)
|
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)
|
inc(s.bySrc, r.Source, r)
|
||||||
km := s.byKeyModel[r.Key]
|
km := s.byKeyModel[r.Key]
|
||||||
if km == nil {
|
if km == nil {
|
||||||
km = map[string]*Stat{}
|
km = map[string]*Stat{}
|
||||||
s.byKeyModel[r.Key] = km
|
s.byKeyModel[r.Key] = km
|
||||||
}
|
}
|
||||||
inc(km, r.Model, r)
|
if r.Model != "" {
|
||||||
|
inc(km, r.Model, r)
|
||||||
|
}
|
||||||
ks := s.byKeySrc[r.Key]
|
ks := s.byKeySrc[r.Key]
|
||||||
if ks == nil {
|
if ks == nil {
|
||||||
ks = map[string]*Stat{}
|
ks = map[string]*Stat{}
|
||||||
|
|||||||
Reference in New Issue
Block a user