Jelajahi Sumber

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>
(cherry picked from commit 2ad37e183255e1abf9ca0d06b672338973a04d7b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Dorin Geman 2 tahun lalu
induk
melakukan
63640838ba
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  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)