diff --git a/internal/status-exporter/export/fs/exporter.go b/internal/status-exporter/export/fs/exporter.go index e18fa49..97d7179 100644 --- a/internal/status-exporter/export/fs/exporter.go +++ b/internal/status-exporter/export/fs/exporter.go @@ -51,7 +51,7 @@ func (e *FsExporter) export(nodeTopology *topology.NodeTopology) { log.Printf("Exporting pod %s gpu stats to filesystem", podUuid) path := fmt.Sprintf("runai/proc/pod/%s/metrics/gpu/%d", podUuid, gpuIdx) - if err := os.MkdirAll(filepath.Dir(path), 0644); err != nil { + if err := os.MkdirAll(path, 0644); err != nil { log.Printf("Failed creating directory for pod %s: %s", podUuid, err.Error()) } @@ -59,7 +59,7 @@ func (e *FsExporter) export(nodeTopology *topology.NodeTopology) { log.Printf("Failed exporting utilization for pod %s: %s", podUuid, err.Error()) } - if err := writeFile(filepath.Join(path, "memory.allocated"), []byte(strconv.Itoa(gpuUsageStatus.FbUsed))); err != nil { + if err := writeFile(filepath.Join(path, "memory.allocated"), []byte(strconv.Itoa(mbToBytes(gpuUsageStatus.FbUsed)))); err != nil { log.Printf("Failed exporting memory for pod %s: %s", podUuid, err.Error()) } } @@ -72,3 +72,7 @@ func writeFile(path string, content []byte) error { } return nil } + +func mbToBytes(mb int) int { + return mb * 1024 * 1024 +}