Context
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.
Context
Surfaced during code review of #111 (finding 4, skipped as pre-existing).
Problem
cmd/devcloud/main.goalways builds a 1000-entryadmin.LogCollector, and the gateway's logging middleware (internal/gateway/gateway.go, inNew) callslogCollector.Add(...)— a mutex lock + ring-buffer insert — on every AWS request, regardless ofadmin.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.Newsignature/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
Addcall (nil collector / no-op recorder) so the middleware short-circuits on the hot path. Keep behavior identical when admin is enabled.Acceptance
logCollector.Addwork per request whenadmin.enabled: false.