diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-16 04:25:26 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-16 04:25:26 +0200 |
| commit | f55a1e88ea5948582d0e5a33efea0c5d806e1f4b (patch) | |
| tree | a180dc8c0266c87b0bc8d05a8e9c18d18748d751 /internal/lsp/handlers_utils.go | |
| parent | 7dd1bfa797b462791dc398690f599a2c5e5d1962 (diff) | |
Add Snapshot.ScopeReqs/ScopeRPM and simplify 3 callers
Centralizes the provider+model map traversal and window-minutes guard
that was duplicated in hexaiaction, hexaicli, and lsp.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/lsp/handlers_utils.go')
| -rw-r--r-- | internal/lsp/handlers_utils.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/internal/lsp/handlers_utils.go b/internal/lsp/handlers_utils.go index 7fb17d2..408fdb1 100644 --- a/internal/lsp/handlers_utils.go +++ b/internal/lsp/handlers_utils.go @@ -170,18 +170,8 @@ func (s *Server) logLLMStats(model string) { if modelName == "" { modelName = client.DefaultModel() } - // Per-scope rpm estimated from window - scopeReqs := int64(0) - if pe, ok := snap.Providers[provider]; ok { - if mc, ok2 := pe.Models[modelName]; ok2 { - scopeReqs = mc.Reqs - } - } - minsWin := snap.Window.Minutes() - if minsWin <= 0 { - minsWin = 0.001 - } - scopeRPM := float64(scopeReqs) / minsWin + scopeReqs := snap.ScopeReqs(provider, modelName) + scopeRPM := snap.ScopeRPM(provider, modelName) s.emitGlobalStatus(snap.Global.Reqs, snap.RPM, snap.Global.Sent, snap.Global.Recv, provider, modelName, scopeRPM, scopeReqs, snap.Window) } } |
