Pārlūkot izejas kodu

Merge pull request #2142 from ctelfer/xfilter-warn-timestamp

Add wait time into xtables lock warning
Flavio Crisciani 7 gadi atpakaļ
vecāks
revīzija
5c679b051d
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3 2
      libnetwork/iptables/iptables.go

+ 3 - 2
libnetwork/iptables/iptables.go

@@ -430,8 +430,9 @@ const opWarnTime = 2 * time.Second
 
 func filterOutput(start time.Time, output []byte, args ...string) []byte {
 	// Flag operations that have taken a long time to complete
-	if time.Since(start) > opWarnTime {
-		logrus.Warnf("xtables contention detected while running [%s]: %q", strings.Join(args, " "), string(output))
+	opTime := time.Since(start)
+	if opTime > opWarnTime {
+		logrus.Warnf("xtables contention detected while running [%s]: Waited for %.2f seconds and received %q", strings.Join(args, " "), float64(opTime)/float64(time.Second), string(output))
 	}
 	// ignore iptables' message about xtables lock:
 	// it is a warning, not an error.