瀏覽代碼

daemon: handleContainerExit(): add execDuration in attributes

Add `execDuration` field to the event attributes map. This is useful for tracking how long the container ran.

Signed-off-by: Dorin Geman <dorin.geman@docker.com>
Dorin Geman 2 年之前
父節點
當前提交
2ad37e1832
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      daemon/monitor.go

+ 2 - 1
daemon/monitor.go

@@ -78,7 +78,8 @@ func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontaine
 	}
 	}
 
 
 	attributes := map[string]string{
 	attributes := map[string]string{
-		"exitCode": strconv.Itoa(exitStatus.ExitCode),
+		"exitCode":     strconv.Itoa(exitStatus.ExitCode),
+		"execDuration": strconv.Itoa(int(execDuration.Seconds())),
 	}
 	}
 	daemon.Cleanup(c)
 	daemon.Cleanup(c)