Skip to content

F-026 (P3) — ResourceStatisticsCollector materializes the instance's entire sample history per cycle #80

Description

@LarsLaskowski

Severity: 🟠 · Criterion: K7 / K6 · Phase: P3 · Status (review): 🆕

File(s): src/DockerUpdateGuard/Images/ResourceStatisticsCollector.cs:167-176

Finding

CollectForInstanceAsync loads all RuntimeContainerResourceSamples of the instance
(Where(instance).OrderByDescending(RecordedAtUtc).AsNoTracking().ToListAsync()), only to determine
via GroupBy(ContainerId).First() the most recent sample per container for the delta calculation.
The table grows between cleanups; with a short sampling interval, more and more rows are loaded
per run. (The instance sample correctly uses FirstOrDefaultAsync.)

Impact

Growing memory/CPU cost in a frequent periodic path, scaling
with retention × frequency × container count; avoidable.

Recommendation

Load only the most recent sample per container (grouped/window query or filter to
a narrow time window).


Auto-generated from the repository code review. Source of truth: docs/review/findings.mdF-026 (P3), branch review/review-analysis-plan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions