Summary
getMachineName fails with an error and skips VMs that are in a transitional state (provisioning, failed, deallocating).
These VMs have InstanceView set but ComputerName empty — the OS hasn't started yet so Azure hasn't populated it. No metrics are emitted for them until the next machine store refresh picks them up in a ready state.
Symptoms
2026-03-31 22:29:22.946 ERROR time=2026-03-31T22:29:22.946Z
level=ERROR
msg="unable to determine machine name: ..."
provider=azure collector=aks subsystem=machineStore
- Logged at ERROR on every machine store refresh cycle (every 5 minutes) for any VM not yet fully running
- The full struct dump with memory addresses makes the log noisy and hard to action
- The VM is skipped — no CPU, memory, or total cost metrics emitted for it
Root cause
getMachineName in pkg/azure/aks/machine_store.go returns only InstanceView.ComputerName. Azure sets this field only once the VM's OS is running. VMs in transitional states have a perfectly usable ARM resource name (vm.Name, e.g. aks-nodepool1-xxxxx-vmss_0) that is always present, but the code doesn't fall back to it.
computerName := to.String(vm.Properties.InstanceView.ComputerName)
if len(computerName) == 0 {
m.logger.Error(fmt.Sprintf("unable to determine machine name: %+v", vm)) // full struct dump
return "", fmt.Errorf("unable to determine machine name: %+v", vm)
}
Proposed fix
Fall back to vm.Name when ComputerName is unavailable. Log a warn with the name instead of erroring with the full struct. Only hard-error if both are absent.
Affected files
- pkg/azure/aks/machine_store.go — getMachineName() (~line 402)
Summary
getMachineNamefails with an error and skips VMs that are in a transitional state (provisioning, failed, deallocating).These VMs have
InstanceViewset butComputerNameempty — the OS hasn't started yet so Azure hasn't populated it. No metrics are emitted for them until the next machine store refresh picks them up in a ready state.Symptoms
Root cause
getMachineNameinpkg/azure/aks/machine_store.goreturns onlyInstanceView.ComputerName. Azure sets this field only once the VM's OS is running. VMs in transitional states have a perfectly usable ARM resource name (vm.Name, e.g.aks-nodepool1-xxxxx-vmss_0) that is always present, but the code doesn't fall back to it.Proposed fix
Fall back to vm.Name when ComputerName is unavailable. Log a warn with the name instead of erroring with the full struct. Only hard-error if both are absent.
Affected files