You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf: admin log collector runs on the hot path even when the admin API is disabled #112
Surfaced during code review of #111 (finding 4, skipped as pre-existing).
Problem
cmd/devcloud/main.go always builds a 1000-entry admin.LogCollector, and the gateway's logging middleware (internal/gateway/gateway.go, in New) calls logCollector.Add(...) — a mutex lock + ring-buffer insert — on every AWS request, regardless of admin.enabled.
When admin.enabled: false (the default), nothing can ever read those logs without a restart, so every request pays for bookkeeping no consumer can reach.
Why it was deferred
Pre-existing behavior (not introduced by #111). Conditionalizing it requires a gateway.New signature/behavior change (e.g. inject an optional collector or a no-op), which is out of proportion to that PR's diff.
Suggested fix
Make the log collector optional: when admin is disabled, skip the Add call (nil collector / no-op recorder) so the middleware short-circuits on the hot path. Keep behavior identical when admin is enabled.
Acceptance
No logCollector.Add work per request when admin.enabled: false.
Admin-enabled behavior (recent-logs endpoint) unchanged, still covered by tests.
Activity
perf: skip log collector on hot path when admin API is disabled (#118)