diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/lsp/server.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 0cede98..9c476ed 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -42,12 +42,7 @@ type Server struct { cfg appconfig.App codeActionSubsystem chatSubsystem - // LLM request stats — atomic to avoid taking the server-wide mu lock. - llmReqTotal atomic.Int64 - llmSentBytesTotal atomic.Int64 - llmRespTotal atomic.Int64 - llmRespBytesTotal atomic.Int64 - startTime time.Time + llmStatsSubsystem completionSubsystem configLoadOpts appconfig.LoadOptions // Outgoing JSON-RPC id counter for server-initiated requests @@ -72,6 +67,16 @@ type codeActionSubsystem struct { llmClientRegistry } +// llmStatsSubsystem holds atomic LLM request counters. All fields are +// lock-free (atomic.Int64), so no mutex is needed. +type llmStatsSubsystem struct { + llmReqTotal atomic.Int64 + llmSentBytesTotal atomic.Int64 + llmRespTotal atomic.Int64 + llmRespBytesTotal atomic.Int64 + startTime time.Time +} + // StatusSink receives status updates from the LSP server. type StatusSink interface { SetLLMStart(provider, model string) error |
