From 180ccf6935baa7e723f79a748ff8f8da7c5253ed Mon Sep 17 00:00:00 2001 From: Kadukuntla Poornima Date: Mon, 27 Jul 2026 08:03:18 +0000 Subject: [PATCH 1/6] feat: Add machine_category telemetry metric --- pkg/telemetry/collector.go | 81 +++++++++++++++++++++++++++++++++ pkg/telemetry/collector_test.go | 76 +++++++++++++++++++++++++++++++ pkg/telemetry/types.go | 1 + 3 files changed, 158 insertions(+) diff --git a/pkg/telemetry/collector.go b/pkg/telemetry/collector.go index 5a130c89c4..393708d17a 100644 --- a/pkg/telemetry/collector.go +++ b/pkg/telemetry/collector.go @@ -18,6 +18,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "hpc-toolkit/pkg/config" "hpc-toolkit/pkg/shell" "net" @@ -66,6 +67,7 @@ func (c *Collector) CollectMetrics(errorCode int, err error) { c.metadata[IS_SLURM] = getIsSlurm(bpModulesList) c.metadata[IS_VM_INSTANCE] = getIsVmInstance(bpModulesList) c.metadata[MACHINE_TYPE] = getMachineType(c.blueprint) + c.metadata[MACHINE_CATEGORY] = getMachineCategory(c.blueprint) c.metadata[STORAGE_TYPE] = getStorageType(c.blueprint) c.metadata[REGION] = getRegion(c.blueprint) c.metadata[ZONE] = getZone(c.blueprint) @@ -231,6 +233,85 @@ func getMachineType(bp config.Blueprint) string { return strings.Join(machineTypes, ",") } +func detectMachineCategory(mType string) string { + mType = strings.ToLower(strings.TrimSpace(mType)) + mType = config.ResolveMachineType(mType) + + if config.IsTPU(mType) { + return "TPU" + } + + gpuPrefixes := []string{"a2-", "a3-", "a4-", "a4x-", "g2-", "g4-"} + for _, p := range gpuPrefixes { + if strings.HasPrefix(mType, p) { + return "GPU" + } + } + if strings.Contains(mType, "gpu") { + return "GPU" + } + + cpuPrefixes := []string{"c2-", "c2d-", "c3-", "c3d-", "c4-", "n1-", "n2-", "n2d-", "n4-", "e2-", "t2a-", "t2d-", "m1-", "m2-", "m3-", "h3-", "z3-", "f1-", "g1-"} + for _, p := range cpuPrefixes { + if strings.HasPrefix(mType, p) { + return "CPU" + } + } + + if strings.Contains(mType, "-standard-") || strings.Contains(mType, "-highmem-") || strings.Contains(mType, "-highcpu-") || strings.Contains(mType, "custom-") { + return "CPU" + } + + return "Other" +} + +func getMachineCategory(bp config.Blueprint) string { + categories := make(map[string]string) + + for _, m := range config.GetAllBpModules(&bp) { + if mt := getMachineTypeFromModule(m, bp); mt != "" { + categories[mt] = detectMachineCategory(mt) + } + + moduleCounts := getModuleNodeCounts(m, bp) + for mt := range moduleCounts { + if mt != "" { + categories[mt] = detectMachineCategory(mt) + } + } + + moduleDynReq := getModuleDynamicNodeCounts(m, bp, dynamicMinNodeCountSettings) + for mt := range moduleDynReq { + if mt != "" { + categories[mt] = detectMachineCategory(mt) + } + } + + moduleDynMax := getModuleDynamicNodeCounts(m, bp, dynamicMaxNodeCountSettings) + for mt := range moduleDynMax { + if mt != "" { + categories[mt] = detectMachineCategory(mt) + } + } + } + + if len(categories) == 0 { + return "" + } + + var keys []string + for k := range categories { + keys = append(keys, k) + } + slices.Sort(keys) + + var builder []string + for _, k := range keys { + builder = append(builder, fmt.Sprintf("%s:%s", k, categories[k])) + } + return strings.Join(builder, ",") +} + func getStorageType(bp config.Blueprint) string { var storageTypes []string seen := make(map[string]bool) diff --git a/pkg/telemetry/collector_test.go b/pkg/telemetry/collector_test.go index 9898de22db..ca34aaf522 100644 --- a/pkg/telemetry/collector_test.go +++ b/pkg/telemetry/collector_test.go @@ -59,6 +59,7 @@ func TestCollectMetrics_Extensible(t *testing.T) { expectedKeys := []string{ COMMAND_FLAGS, MACHINE_TYPE, + MACHINE_CATEGORY, REGION, ZONE, STATIC_NODE_COUNTS, @@ -124,6 +125,7 @@ func TestCollectMetrics_Extensible(t *testing.T) { REGION: "us-central1", ZONE: "us-central1-a", MACHINE_TYPE: "c2-standard-8", + MACHINE_CATEGORY: "c2-standard-8:CPU", STATIC_NODE_COUNTS: "c2-standard-8:1", OS_NAME: getOSName(), // Dynamically expect the current OS name OS_VERSION: getOSVersion(), // Dynamically expect the current OS version @@ -156,6 +158,7 @@ func TestCollectMetrics_Extensible(t *testing.T) { OS_VERSION: getOSVersion(), // Verify OS info is still collected on failure TERRAFORM_VERSION: getTerraformVersion(), // Verify Terraform version is still collected on failure MACHINE_TYPE: "", // Verify empty machine type when no matching modules exist + MACHINE_CATEGORY: "", STATIC_NODE_COUNTS: "", INSTALLATION_MODE: BINARY, }, @@ -3010,3 +3013,76 @@ func TestGetIsAIAssisted(t *testing.T) { }) } } + +func TestGetMachineCategory(t *testing.T) { + tests := []struct { + name string + bp config.Blueprint + want string + }{ + { + name: "GPU, CPU and TPU mapping", + bp: config.Blueprint{ + Groups: []config.Group{ + { + Name: config.GroupName("primary"), + Modules: []config.Module{ + { + ID: config.ModuleID("compute_node_1"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("g4-standard-48"), + }), + }, + { + ID: config.ModuleID("compute_node_2"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("tpu7x-standard-4t"), + }), + }, + { + ID: config.ModuleID("compute_node_3"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("c2-standard-4"), + }), + }, + }, + }, + }, + }, + want: "c2-standard-4:CPU,g4-standard-48:GPU,tpu7x-standard-4t:TPU", + }, + { + name: "Handles shorthand mapping for TPU and GPU", + bp: config.Blueprint{ + Groups: []config.Group{ + { + Name: config.GroupName("primary"), + Modules: []config.Module{ + { + ID: config.ModuleID("compute_node_4"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("a100-40gb-1"), // g2 short hand actually a2 + }), + }, + { + ID: config.ModuleID("compute_node_5"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("v6e-4"), // v6e TPU shorthand + }), + }, + }, + }, + }, + }, + want: "a100-40gb-1:GPU,v6e-4:TPU", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := getMachineCategory(tt.bp); got != tt.want { + t.Errorf("getMachineCategory() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/pkg/telemetry/types.go b/pkg/telemetry/types.go index c8d55c6452..d9bc7c095d 100644 --- a/pkg/telemetry/types.go +++ b/pkg/telemetry/types.go @@ -89,6 +89,7 @@ const ( IS_SLURM = "CLUSTER_TOOLKIT_IS_SLURM" IS_VM_INSTANCE = "CLUSTER_TOOLKIT_IS_VM_INSTANCE" MACHINE_TYPE = "CLUSTER_TOOLKIT_MACHINE_TYPE" + MACHINE_CATEGORY = "CLUSTER_TOOLKIT_MACHINE_CATEGORY" STORAGE_TYPE = "CLUSTER_TOOLKIT_STORAGE_TYPE" REGION = "CLUSTER_TOOLKIT_REGION" ZONE = "CLUSTER_TOOLKIT_ZONE" From 2cedfed8befad332d74903ef5d82cb25bf2c173f Mon Sep 17 00:00:00 2001 From: Kadukuntla Poornima Date: Mon, 27 Jul 2026 08:03:18 +0000 Subject: [PATCH 2/6] feat: Add machine_category telemetry metric Change-Id: I7eb7dff27edbb553b8df0c3b8d99c0b623577a0f --- pkg/telemetry/collector.go | 79 +++-------------------------- pkg/telemetry/collector_test.go | 89 ++++++++++++++++++++++++++++++++- pkg/telemetry/collector_util.go | 36 +++++++++++++ 3 files changed, 132 insertions(+), 72 deletions(-) diff --git a/pkg/telemetry/collector.go b/pkg/telemetry/collector.go index 393708d17a..2aadb88199 100644 --- a/pkg/telemetry/collector.go +++ b/pkg/telemetry/collector.go @@ -233,83 +233,20 @@ func getMachineType(bp config.Blueprint) string { return strings.Join(machineTypes, ",") } -func detectMachineCategory(mType string) string { - mType = strings.ToLower(strings.TrimSpace(mType)) - mType = config.ResolveMachineType(mType) - - if config.IsTPU(mType) { - return "TPU" - } - - gpuPrefixes := []string{"a2-", "a3-", "a4-", "a4x-", "g2-", "g4-"} - for _, p := range gpuPrefixes { - if strings.HasPrefix(mType, p) { - return "GPU" - } - } - if strings.Contains(mType, "gpu") { - return "GPU" - } - - cpuPrefixes := []string{"c2-", "c2d-", "c3-", "c3d-", "c4-", "n1-", "n2-", "n2d-", "n4-", "e2-", "t2a-", "t2d-", "m1-", "m2-", "m3-", "h3-", "z3-", "f1-", "g1-"} - for _, p := range cpuPrefixes { - if strings.HasPrefix(mType, p) { - return "CPU" - } - } - - if strings.Contains(mType, "-standard-") || strings.Contains(mType, "-highmem-") || strings.Contains(mType, "-highcpu-") || strings.Contains(mType, "custom-") { - return "CPU" - } - - return "Other" -} - +// getMachineCategory extracts unique machine designations defined across modules in the blueprint +// and maps each to its inferred hardware category (e.g. CPU, GPU, TPU, Other) generating a formatted summary. func getMachineCategory(bp config.Blueprint) string { - categories := make(map[string]string) + var categories []string + seen := make(map[string]bool) for _, m := range config.GetAllBpModules(&bp) { - if mt := getMachineTypeFromModule(m, bp); mt != "" { - categories[mt] = detectMachineCategory(mt) + if mt := getMachineTypeFromModule(m, bp); mt != "" && !seen[mt] { + categories = append(categories, fmt.Sprintf("%s:%s", mt, detectMachineCategory(mt))) + seen[mt] = true } - - moduleCounts := getModuleNodeCounts(m, bp) - for mt := range moduleCounts { - if mt != "" { - categories[mt] = detectMachineCategory(mt) - } - } - - moduleDynReq := getModuleDynamicNodeCounts(m, bp, dynamicMinNodeCountSettings) - for mt := range moduleDynReq { - if mt != "" { - categories[mt] = detectMachineCategory(mt) - } - } - - moduleDynMax := getModuleDynamicNodeCounts(m, bp, dynamicMaxNodeCountSettings) - for mt := range moduleDynMax { - if mt != "" { - categories[mt] = detectMachineCategory(mt) - } - } - } - - if len(categories) == 0 { - return "" } - var keys []string - for k := range categories { - keys = append(keys, k) - } - slices.Sort(keys) - - var builder []string - for _, k := range keys { - builder = append(builder, fmt.Sprintf("%s:%s", k, categories[k])) - } - return strings.Join(builder, ",") + return strings.Join(categories, ",") } func getStorageType(bp config.Blueprint) string { diff --git a/pkg/telemetry/collector_test.go b/pkg/telemetry/collector_test.go index ca34aaf522..4bbec0300f 100644 --- a/pkg/telemetry/collector_test.go +++ b/pkg/telemetry/collector_test.go @@ -3049,7 +3049,7 @@ func TestGetMachineCategory(t *testing.T) { }, }, }, - want: "c2-standard-4:CPU,g4-standard-48:GPU,tpu7x-standard-4t:TPU", + want: "g4-standard-48:GPU,tpu7x-standard-4t:TPU,c2-standard-4:CPU", }, { name: "Handles shorthand mapping for TPU and GPU", @@ -3076,6 +3076,93 @@ func TestGetMachineCategory(t *testing.T) { }, want: "a100-40gb-1:GPU,v6e-4:TPU", }, + { + name: "Handles unknown machine types mapped to Other", + bp: config.Blueprint{ + Groups: []config.Group{ + { + Name: config.GroupName("primary"), + Modules: []config.Module{ + { + ID: config.ModuleID("compute_unknown"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("bizarre-type-1"), + }), + }, + }, + }, + }, + }, + want: "bizarre-type-1:Other", + }, + { + name: "Handles trailing spaces and upper casing in machine types to normalize appropriately", + bp: config.Blueprint{ + Groups: []config.Group{ + { + Name: config.GroupName("primary"), + Modules: []config.Module{ + { + ID: config.ModuleID("compute_noisy"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal(" N2-Standard-4 "), + }), + }, + }, + }, + }, + }, + want: "N2-Standard-4:CPU", + }, + { + name: "Handles deduping duplicate machine types", + bp: config.Blueprint{ + Groups: []config.Group{ + { + Name: config.GroupName("primary"), + Modules: []config.Module{ + { + ID: config.ModuleID("compute_1"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("e2-micro"), + }), + }, + { + ID: config.ModuleID("compute_2"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("e2-micro"), + }), + }, + }, + }, + }, + }, + want: "e2-micro:CPU", + }, + { + name: "Returns empty string for blueprint with no compute instances", + bp: config.Blueprint{ + Groups: []config.Group{ + { + Name: config.GroupName("primary"), + Modules: []config.Module{ + { + ID: config.ModuleID("storage"), + Settings: config.NewDict(map[string]cty.Value{ + "disk_type": cty.StringVal("pd-standard"), + }), + }, + }, + }, + }, + }, + want: "", + }, + { + name: "Returns empty string for empty blueprint", + bp: config.Blueprint{}, + want: "", + }, } for _, tt := range tests { diff --git a/pkg/telemetry/collector_util.go b/pkg/telemetry/collector_util.go index 918d38c28b..cb89d8dd15 100644 --- a/pkg/telemetry/collector_util.go +++ b/pkg/telemetry/collector_util.go @@ -1075,3 +1075,39 @@ func getModuleDynamicNodeCounts(m config.Module, bp config.Blueprint, targetKeys } return counts } + +// detectMachineCategory attempts to identify the hardware nature of an instantiated machine type +// by interpreting available cluster toolkit mappings (e.g. associating mapped nvidia labels with GPUs). +// Returns "CPU", "GPU", "TPU", or "Other". +func detectMachineCategory(mType string) string { + mType = strings.ToLower(strings.TrimSpace(mType)) + mType = config.ResolveMachineType(mType) + + if config.IsTPU(mType) { + return "TPU" + } + + mappings := config.GetMachineMappings() + + for family, label := range mappings.MachineFamilyToLabelMap { + if strings.HasPrefix(mType, family) && strings.Contains(label, "nvidia") { + return "GPU" + } + } + + if strings.Contains(mType, "gpu") { + return "GPU" + } + + for _, p := range mappings.CpuMachineFamilies { + if strings.HasPrefix(mType, p) { + return "CPU" + } + } + + if strings.Contains(mType, "-standard-") || strings.Contains(mType, "-highmem-") || strings.Contains(mType, "-highcpu-") || strings.Contains(mType, "custom-") { + return "CPU" + } + + return "Other" +} From f6626971f48934a24492ff188ee2568af4669792 Mon Sep 17 00:00:00 2001 From: Kadukuntla Poornima Date: Mon, 27 Jul 2026 08:35:31 +0000 Subject: [PATCH 3/6] . Change-Id: I40a93eca881f3cd1c1cd1540fa1b5827216b4546 --- pkg/telemetry/collector.go | 3 +-- pkg/telemetry/collector_util.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/telemetry/collector.go b/pkg/telemetry/collector.go index 2aadb88199..50bdb30bf3 100644 --- a/pkg/telemetry/collector.go +++ b/pkg/telemetry/collector.go @@ -233,8 +233,7 @@ func getMachineType(bp config.Blueprint) string { return strings.Join(machineTypes, ",") } -// getMachineCategory extracts unique machine designations defined across modules in the blueprint -// and maps each to its inferred hardware category (e.g. CPU, GPU, TPU, Other) generating a formatted summary. +// getMachineCategory maps each machine type to its inferred hardware category (CPU/GPU/TPU/Other) func getMachineCategory(bp config.Blueprint) string { var categories []string seen := make(map[string]bool) diff --git a/pkg/telemetry/collector_util.go b/pkg/telemetry/collector_util.go index cb89d8dd15..e5f3a89ae1 100644 --- a/pkg/telemetry/collector_util.go +++ b/pkg/telemetry/collector_util.go @@ -1076,8 +1076,7 @@ func getModuleDynamicNodeCounts(m config.Module, bp config.Blueprint, targetKeys return counts } -// detectMachineCategory attempts to identify the hardware nature of an instantiated machine type -// by interpreting available cluster toolkit mappings (e.g. associating mapped nvidia labels with GPUs). +// detectMachineCategory attempts to identify the hardware nature of an instantiated machine type by interpreting available cluster toolkit mappings (e.g. associating mapped nvidia labels with GPUs). // Returns "CPU", "GPU", "TPU", or "Other". func detectMachineCategory(mType string) string { mType = strings.ToLower(strings.TrimSpace(mType)) From 2fa16c620c8d5976c08241cf7eab5789ec9321c8 Mon Sep 17 00:00:00 2001 From: kadupoornima Date: Mon, 27 Jul 2026 14:52:51 +0530 Subject: [PATCH 4/6] Update pkg/telemetry/collector_util.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- pkg/telemetry/collector_util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/telemetry/collector_util.go b/pkg/telemetry/collector_util.go index e5f3a89ae1..7e75ce403a 100644 --- a/pkg/telemetry/collector_util.go +++ b/pkg/telemetry/collector_util.go @@ -1104,7 +1104,7 @@ func detectMachineCategory(mType string) string { } } - if strings.Contains(mType, "-standard-") || strings.Contains(mType, "-highmem-") || strings.Contains(mType, "-highcpu-") || strings.Contains(mType, "custom-") { + if strings.Contains(mType, "-standard-") || strings.Contains(mType, "-highmem-") || strings.Contains(mType, "-highcpu-") || strings.Contains(mType, "-megamem-") || strings.Contains(mType, "-ultramem-") || strings.Contains(mType, "custom-") { return "CPU" } From 3c31c86583a2617e8cfcf8ba83e6d5471b3f36c8 Mon Sep 17 00:00:00 2001 From: Kadukuntla Poornima Date: Mon, 27 Jul 2026 09:31:33 +0000 Subject: [PATCH 5/6] . Change-Id: Ieab1fa5f38cdfcb2e7f0de9934bf69f51463ded5 --- pkg/telemetry/collector_test.go | 25 +++++++++++++++++++++++++ pkg/telemetry/collector_util.go | 16 +++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/pkg/telemetry/collector_test.go b/pkg/telemetry/collector_test.go index 4bbec0300f..d1161a28b3 100644 --- a/pkg/telemetry/collector_test.go +++ b/pkg/telemetry/collector_test.go @@ -3076,6 +3076,31 @@ func TestGetMachineCategory(t *testing.T) { }, want: "a100-40gb-1:GPU,v6e-4:TPU", }, + { + name: "Handles memory-optimized machine types correctly as CPU", + bp: config.Blueprint{ + Groups: []config.Group{ + { + Name: config.GroupName("primary"), + Modules: []config.Module{ + { + ID: config.ModuleID("compute_mem_1"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("m1-megamem-96"), + }), + }, + { + ID: config.ModuleID("compute_mem_2"), + Settings: config.NewDict(map[string]cty.Value{ + "machine_type": cty.StringVal("m2-ultramem-208"), + }), + }, + }, + }, + }, + }, + want: "m1-megamem-96:CPU,m2-ultramem-208:CPU", + }, { name: "Handles unknown machine types mapped to Other", bp: config.Blueprint{ diff --git a/pkg/telemetry/collector_util.go b/pkg/telemetry/collector_util.go index 7e75ce403a..0fbf646103 100644 --- a/pkg/telemetry/collector_util.go +++ b/pkg/telemetry/collector_util.go @@ -1104,9 +1104,23 @@ func detectMachineCategory(mType string) string { } } - if strings.Contains(mType, "-standard-") || strings.Contains(mType, "-highmem-") || strings.Contains(mType, "-highcpu-") || strings.Contains(mType, "-megamem-") || strings.Contains(mType, "-ultramem-") || strings.Contains(mType, "custom-") { + if isCPUFallback(mType) { return "CPU" } return "Other" } + +// isCPUFallback checks if the machine type contains any of the standard CPU identifiers. +func isCPUFallback(mType string) bool { + cpuKeywords := []string{ + "-standard-", "-highmem-", "-highcpu-", + "-megamem-", "-ultramem-", "custom-", + } + for _, kw := range cpuKeywords { + if strings.Contains(mType, kw) { + return true + } + } + return false +} From 4d3c7a8ad33a8e2add7133e4be991c5ce9ffda91 Mon Sep 17 00:00:00 2001 From: Kadukuntla Poornima Date: Tue, 28 Jul 2026 10:48:18 +0000 Subject: [PATCH 6/6] comment-1 --- pkg/telemetry/collector.go | 14 +++++++------- pkg/telemetry/collector_test.go | 25 ------------------------- pkg/telemetry/collector_util.go | 4 ++-- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/pkg/telemetry/collector.go b/pkg/telemetry/collector.go index 50bdb30bf3..659e847255 100644 --- a/pkg/telemetry/collector.go +++ b/pkg/telemetry/collector.go @@ -235,14 +235,14 @@ func getMachineType(bp config.Blueprint) string { // getMachineCategory maps each machine type to its inferred hardware category (CPU/GPU/TPU/Other) func getMachineCategory(bp config.Blueprint) string { - var categories []string - seen := make(map[string]bool) + machineTypes := getMachineType(bp) + if machineTypes == "" { + return "" + } - for _, m := range config.GetAllBpModules(&bp) { - if mt := getMachineTypeFromModule(m, bp); mt != "" && !seen[mt] { - categories = append(categories, fmt.Sprintf("%s:%s", mt, detectMachineCategory(mt))) - seen[mt] = true - } + var categories []string + for _, mt := range strings.Split(machineTypes, ",") { + categories = append(categories, fmt.Sprintf("%s:%s", mt, detectMachineCategory(mt))) } return strings.Join(categories, ",") diff --git a/pkg/telemetry/collector_test.go b/pkg/telemetry/collector_test.go index d1161a28b3..4bbec0300f 100644 --- a/pkg/telemetry/collector_test.go +++ b/pkg/telemetry/collector_test.go @@ -3076,31 +3076,6 @@ func TestGetMachineCategory(t *testing.T) { }, want: "a100-40gb-1:GPU,v6e-4:TPU", }, - { - name: "Handles memory-optimized machine types correctly as CPU", - bp: config.Blueprint{ - Groups: []config.Group{ - { - Name: config.GroupName("primary"), - Modules: []config.Module{ - { - ID: config.ModuleID("compute_mem_1"), - Settings: config.NewDict(map[string]cty.Value{ - "machine_type": cty.StringVal("m1-megamem-96"), - }), - }, - { - ID: config.ModuleID("compute_mem_2"), - Settings: config.NewDict(map[string]cty.Value{ - "machine_type": cty.StringVal("m2-ultramem-208"), - }), - }, - }, - }, - }, - }, - want: "m1-megamem-96:CPU,m2-ultramem-208:CPU", - }, { name: "Handles unknown machine types mapped to Other", bp: config.Blueprint{ diff --git a/pkg/telemetry/collector_util.go b/pkg/telemetry/collector_util.go index 0fbf646103..3f35ac5f6e 100644 --- a/pkg/telemetry/collector_util.go +++ b/pkg/telemetry/collector_util.go @@ -1114,8 +1114,8 @@ func detectMachineCategory(mType string) string { // isCPUFallback checks if the machine type contains any of the standard CPU identifiers. func isCPUFallback(mType string) bool { cpuKeywords := []string{ - "-standard-", "-highmem-", "-highcpu-", - "-megamem-", "-ultramem-", "custom-", + "-standard-", "-highmem-", "-highcpu-", "-megamem-", + "-ultramem-", "custom-", "-micro", "-small", "-medium", "-metal", } for _, kw := range cpuKeywords { if strings.Contains(mType, kw) {