[Backend][Metrics] SpikerSoft.Business.Metrics is inert — IInfluxMetricsService has no consumer, metric models are duplicated, namespace doesn't match the project, and InfluxDashboard re-implements the aggregation #577
Reference in New Issue
Block a user
QA Team — filed 2026-07-14 from the README audit, at spikerj's direction (decision: ticket a consolidation).
Four findings in one slice, all verified by grep across non-obj sources:
IInfluxMetricsService/InfluxMetricsServicehas NO runtime consumer. It exists, it compiles, nothing calls it. TheInfluxDashboardHostedService(the one service that would want it) does its own storage aggregation inline instead.SpikerSoft.Business.Services.InfluxDB.Models.{CpuMetric, AggregatedCpuMetrics}exist in both this project andSpikerSoft.Business— two definitions, no single source of truth.SpikerSoft.Business.Services.InfluxDBin a project namedSpikerSoft.Business.Metrics(a decomposition artifact — the namespace was kept for consumer compatibility, but there are no consumers to keep compatible).InfluxDashboardHostedServiceeven though the service's own options already carryStorage*fields — the abstraction was built and then bypassed.Ask: pick one model set and delete the other; make
InfluxDashboardHostedServiceconsumeIInfluxMetricsService(moving the aggregation into it) or delete the service outright if the worker is genuinely the right home; align the namespace with the project name while the blast radius is zero.Related: #566 (the wider Business decomposition — this is one of its slices), #571 (the dashboard's Hostnames config misses dreamstream7 — same worker).
Fix up in spikersoft-backend PR #295 (open, awaiting merge).
Heads up: this ticket's second option would have been a regression. #577 offered "make
InfluxDashboardHostedServiceconsumeIInfluxMetricsService(moving the aggregation into it)". I read the dead implementation before choosing, andInfluxMetricsService.AggregateMetricsByHostisn't just unused — it's wrong. It groups every metric by field intoCpuValues(so RAM bytes and storage bytes land next to CPU percentages), averages all of them intoAverageCpu, and computes no RAM/storage aggregation at all. The worker's live implementation already splits by measurement and derives utilisation correctly, and its existingInfluxStorageAggregationTestsalready prove it. Promoting the dead copy would have swapped correct code for broken code — so it's deleted, not promoted.Done:
SpikerSoft.Business.Metricsoutright (the unregisteredIInfluxMetricsService, the duplicateCpuMetric/AggregatedCpuMetricsshadowingSpikerSoft.Data.Models.Influx, the mismatched namespace); dropped from the solution and everyProjectReferenceInfluxDashboardOptions, into the worker that consumes itWindowPeriodandTimeRangeStart— their only consumer was the deleted service, so they were inert knobs that bound cleanly and steered nothing (the query path hardcodesrange(start: -30s)). The worker README already said to ignore both "until #577".COPYof the deleted csproj from 4 Dockerfiles. Worth knowing: that break would have surfaced only in CI's Docker build, never indotnet build.Two guards, both verified to actually fail when the defect is reintroduced:
MetricModelsHaveOneSourceOfTruthTests(a duplicate type doesn't break the build — you just silently get the wrong one) andTheDeadTimeWindowKnobs_AreNotBack. Full sweep: 8,419 tests, 0 failures.Leaving this open until #295 merges.
Two follow-ups filed separately — the three repository methods this orphans, and a committed InfluxDB token I found in
SpikerSoft.Api/appsettings.json.PR #295 merged to
master. Closing.SpikerSoft.Business.Metricsis gone,InfluxDashboardOptionslives in the worker that consumes it, and the two dead options (WindowPeriod,TimeRangeStart) are removed. Both guards are in place and were verified to fail when their defect is reintroduced.Follow-ups tracked separately: #601 (the three repository methods this orphaned) and #600 (the committed InfluxDB token found in
SpikerSoft.Api/appsettings.json— needs rotation, not just deletion).