Skip to content

Commit f6b5f3d

Browse files
committed
Fix metric details
Signed-off-by: ghokun <[email protected]>
1 parent 1e102d7 commit f6b5f3d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

pkg/gpu/nvidia/metrics.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ func collectMetrics(w http.ResponseWriter, r *http.Request) {
7777
log.Printf("Found %d containers", len(containers.Containers))
7878
containerMap := make(map[string]containerInfo)
7979
for _, container := range containers.GetContainers() {
80-
log.Printf("Found container %s", container.GetId())
81-
containerMap[container.Id] = containerInfo{
80+
log.Printf("Found container %+v", container)
81+
containerMap[container.GetId()] = containerInfo{
8282
Node: node,
83-
Namespace: container.Labels["io.kubernetes.pod.namespace"],
84-
Pod: container.Labels["io.kubernetes.pod.name"],
85-
PodUid: container.Labels["io.kubernetes.pod.uid"],
86-
Container: container.Metadata.Name,
83+
Namespace: container.GetLabels()["io.kubernetes.pod.namespace"],
84+
Pod: container.GetLabels()["io.kubernetes.pod.name"],
85+
PodUid: container.GetLabels()["io.kubernetes.pod.uid"],
86+
Container: container.GetMetadata().GetName(),
8787
ContainerId: container.GetId(),
8888
}
8989
}
@@ -96,7 +96,8 @@ func collectMetrics(w http.ResponseWriter, r *http.Request) {
9696
log.Printf("Found %d processes on GPU %d", len(processes), i)
9797
for _, process := range processes {
9898
containerId := getContainerId(process.Pid)
99-
container := containerMap[containerId[:13]]
99+
container := containerMap[containerId]
100+
log.Printf("Found container %+v for process: %d", container, process.Pid)
100101
collected = append(collected, metric{
101102
Pid: process.Pid,
102103
UsedGpuMemory: process.UsedGpuMemory,

0 commit comments

Comments
 (0)