Context
src/analytics/analytics.interceptor.ts + service record RequestLog per request (createMany in a time window, per spec) with no retention.
Problem
As the analytics interceptor applies to every HTTP request, RequestLog grows at request volume; pruning is absent (CleanupService gap) and burst writes still queue. Analytics data becomes a storage and maybe compliance liability.
Proposed approach
Add RequestLog retention to CleanupService (CLEANUP_REQUESTLOG_DAYS), coalesce writes to Redis buffers with a flush cron, and surface write-failure rates in metrics.
Acceptance criteria
- RequestLog is bounded; interceptor: no DB strain at peak traffic.
Context
src/analytics/analytics.interceptor.ts+ service recordRequestLogper request (createMany in a time window, per spec) with no retention.Problem
As the analytics interceptor applies to every HTTP request,
RequestLoggrows at request volume; pruning is absent (CleanupService gap) and burst writes still queue. Analytics data becomes a storage and maybe compliance liability.Proposed approach
Add
RequestLogretention toCleanupService(CLEANUP_REQUESTLOG_DAYS), coalesce writes to Redis buffers with a flush cron, and surface write-failure rates in metrics.Acceptance criteria