mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 02:25:56 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user