Warm registry view caches before resolving mock metrics targets

The mock unified snapshot resolved a metrics target per resource on a
freshly ingested registry whose view caches were still dirty, so every
resolution fell back to a scan over all source mappings, turning the
loop quadratic at demo scale. One view read builds the caches first,
making each resolution an index lookup.

Contract-Neutral: performance-only cache warm before target resolution, resolved targets unchanged
This commit is contained in:
rcourtman
2026-08-16 22:01:55 +01:00
parent d18fcf55ad
commit db4ef39d87
+5
View File
@@ -229,6 +229,11 @@ func (g FixtureGraph) UnifiedResourceSnapshot() ([]unifiedresources.Resource, ti
}
resources := registry.List()
// Force one view-cache build before resolving targets: on a freshly
// ingested registry the caches are dirty and every MetricsTarget call
// would fall back to a scan over all source mappings, which at demo
// scale turns this loop quadratic.
registry.VMs()
for i := range resources {
if target := registry.MetricsTarget(resources[i].ID); target != nil {
resources[i].MetricsTarget = target