Summary
Follow-up to PR #81 (perf(azure): batched SKU catalogue lookup eliminates N+1 in recommendation converters), which closed #49 for cache / cosmosdb / database but explicitly scoped back compute.
The two enrichments the SKU catalogue would supply for compute are vCPU and MemoryGB, sourced from armcompute.ResourceSKUsClient.ListByLocation(region) → ResourceSKU.Capabilities. Neither has a field on common.ComputeDetails (pkg/common/types.go) to write into — the struct currently exposes only InstanceType, Platform, Tenancy, Scope. Adding new fields touches every cloud provider (AWS, Azure, GCP) + every consumer (frontend rendering, common matchers, snapshot/golden tests), which is well outside the scope of an Azure perf change.
Current behaviour
providers/azure/services/compute/client.go::convertAzureVMRecommendation (line ~703) builds common.ComputeDetails{InstanceType: f.ResourceType} only. The function godoc (post-#81) explicitly explains the scope decision and points back here.
Expected behaviour
Full ComputeDetails population: vCPU, MemoryGB, plus the existing InstanceType / Platform / Tenancy / Scope. UI tables render the actual instance shape instead of just the SKU name.
Proposed fix
Three-step refactor, ideally as separate atomic commits in a single PR:
- Extend
common.ComputeDetails: add VCPU int + MemoryGB float64. JSON tags consistent with existing fields. Update Go-side consumers (matchers, frontend type bindings via pkg/common → frontend types.ts).
- Update AWS + GCP converters: populate the new fields where the SDK already exposes them (AWS DescribeInstanceTypes, GCP MachineType).
- Wire Azure: port the same lazy
cachedSKULookup pattern from cache/cosmos/database into compute/client.go, hitting armcompute.ResourceSKUsClient.NewListPager(region) once per client lifetime, mapping ResourceSKU.Name → {VCPU, MemoryGB}. Converter reads from the cache and falls back to zero on miss.
Test plan
- Per-converter unit tests for AWS/Azure/GCP: SKU catalogue / instance-type cache returns known {vCPU, memoryGB} → assert
Details.VCPU and Details.MemoryGB are populated. Catalogue fetch error → fields stay 0, conversion succeeds.
- Pin the perf invariant in Azure:
_CachedSKULookup_FetchedOnce analogue, multiple converter calls hit the catalogue once.
- Snapshot/golden-test updates for any frontend rendering that exposes the new fields.
References
Severity
Medium — UI degrades to "unknown" for vCPU/memory on Azure compute recs (and presumably AWS/GCP if they also leave the field empty pending the type extension).
Effort
Medium — type extension is mechanical but cross-cutting (3 providers, frontend, matchers, snapshot tests). Wiring the Azure SKU cache itself is ~30 LOC mirroring cache/cosmos/database.
Summary
Follow-up to PR #81 (
perf(azure): batched SKU catalogue lookup eliminates N+1 in recommendation converters), which closed #49 for cache / cosmosdb / database but explicitly scoped back compute.The two enrichments the SKU catalogue would supply for compute are vCPU and MemoryGB, sourced from
armcompute.ResourceSKUsClient.ListByLocation(region) → ResourceSKU.Capabilities. Neither has a field oncommon.ComputeDetails(pkg/common/types.go) to write into — the struct currently exposes onlyInstanceType,Platform,Tenancy,Scope. Adding new fields touches every cloud provider (AWS, Azure, GCP) + every consumer (frontend rendering, common matchers, snapshot/golden tests), which is well outside the scope of an Azure perf change.Current behaviour
providers/azure/services/compute/client.go::convertAzureVMRecommendation(line ~703) buildscommon.ComputeDetails{InstanceType: f.ResourceType}only. The function godoc (post-#81) explicitly explains the scope decision and points back here.Expected behaviour
Full
ComputeDetailspopulation:vCPU,MemoryGB, plus the existingInstanceType/Platform/Tenancy/Scope. UI tables render the actual instance shape instead of just the SKU name.Proposed fix
Three-step refactor, ideally as separate atomic commits in a single PR:
common.ComputeDetails: addVCPU int+MemoryGB float64. JSON tags consistent with existing fields. Update Go-side consumers (matchers, frontend type bindings viapkg/common→ frontendtypes.ts).cachedSKULookuppattern from cache/cosmos/database intocompute/client.go, hittingarmcompute.ResourceSKUsClient.NewListPager(region)once per client lifetime, mappingResourceSKU.Name → {VCPU, MemoryGB}. Converter reads from the cache and falls back to zero on miss.Test plan
Details.VCPUandDetails.MemoryGBare populated. Catalogue fetch error → fields stay 0, conversion succeeds._CachedSKULookup_FetchedOnceanalogue, multiple converter calls hit the catalogue once.References
pkg/common/types.go::ComputeDetailsproviders/azure/services/compute/client.go::convertAzureVMRecommendationproviders/aws/services/compute/...(mirror)providers/gcp/services/compute/...(mirror)frontend/src/types.ts(renderer types)known_issues/10_azure_provider.md→ "MEDIUM: Azure compute Details vCPU/MemoryGB require ComputeDetails type extension"Severity
Medium — UI degrades to "unknown" for vCPU/memory on Azure compute recs (and presumably AWS/GCP if they also leave the field empty pending the type extension).
Effort
Medium — type extension is mechanical but cross-cutting (3 providers, frontend, matchers, snapshot tests). Wiring the Azure SKU cache itself is ~30 LOC mirroring cache/cosmos/database.