Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

perf: Use strconv.Itoa instead of fmt.Sprintf for int conversion

rcourtmanc81bbba8a38c
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index 22accaa6d6..0b1dee1dd0 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -7264,7 +7264,7 @@ func buildGuestLookups(snapshot models.StateSnapshot, metadataStore *config.Gues
key := alerts.BuildGuestKey(vm.Instance, vm.Node, vm.VMID)
byKey[key] = info
- vmidKey := fmt.Sprintf("%d", vm.VMID)
+ vmidKey := strconv.Itoa(vm.VMID)
byVMID[vmidKey] = append(byVMID[vmidKey], info)
// Persist last-known name and type for this guest
@@ -7286,7 +7286,7 @@ func buildGuestLookups(snapshot models.StateSnapshot, metadataStore *config.Gues
byKey[key] = info
}
- vmidKey := fmt.Sprintf("%d", ct.VMID)
+ vmidKey := strconv.Itoa(ct.VMID)
byVMID[vmidKey] = append(byVMID[vmidKey], info)
// Persist last-known name and type for this guest
@@ -7320,7 +7320,7 @@ func enrichWithPersistedMetadata(metadataStore *config.GuestMetadataStore, byVMI
continue // Invalid key format
}
- vmidKey := fmt.Sprintf("%d", vmid)
+ vmidKey := strconv.Itoa(vmid)
// Check if we already have a live entry for this exact guest
hasLiveEntry := false
diff --git a/internal/monitoring/temperature.go b/internal/monitoring/temperature.go
index 7a2242ae54..e93da6ba2d 100644
--- a/internal/monitoring/temperature.go
+++ b/internal/monitoring/temperature.go
@@ -259,7 +259,7 @@ func (tc *TemperatureCollector) runSSHCommand(ctx context.Context, host, command
"-o", "BatchMode=yes",
"-o", "LogLevel=ERROR", // Suppress host key warnings that break JSON parsing
"-o", "ConnectTimeout=5",
- "-p", fmt.Sprintf("%d", tc.sshPort), // Use configured SSH port
+ "-p", strconv.Itoa(tc.sshPort), // Use configured SSH port
}
if tc.hostKeys != nil && tc.hostKeys.Path() != "" {