浏览代码

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

Add wait time into xtables lock warning
Flavio Crisciani 7 年之前
父节点
当前提交
5c679b051d
共有 1 个文件被更改,包括 3 次插入2 次删除
  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 {
 func filterOutput(start time.Time, output []byte, args ...string) []byte {
 	// Flag operations that have taken a long time to complete
 	// 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:
 	// ignore iptables' message about xtables lock:
 	// it is a warning, not an error.
 	// it is a warning, not an error.