From 47096e1ffdfe248fa73292d2942a7751e1cb6281 Mon Sep 17 00:00:00 2001 From: Vishnu Kannan Date: Thu, 24 Jul 2014 00:26:13 +0000 Subject: [PATCH] Fix veth network stats. Tx on the host vETH is ingress traffic and not egress. Docker-DCO-1.1-Signed-off-by: Vishnu Kannan (github: vishh) --- network/stats.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/network/stats.go b/network/stats.go index 4136e2d1..c8ece5c7 100644 --- a/network/stats.go +++ b/network/stats.go @@ -30,15 +30,16 @@ func GetStats(networkState *NetworkState) (*NetworkStats, error) { return nil, err } + // Ingress for host veth is from the container. Hence tx_bytes stat on the host veth is actually number of bytes received by the container. return &NetworkStats{ - RxBytes: data["rx_bytes"], - RxPackets: data["rx_packets"], - RxErrors: data["rx_errors"], - RxDropped: data["rx_dropped"], - TxBytes: data["tx_bytes"], - TxPackets: data["tx_packets"], - TxErrors: data["tx_errors"], - TxDropped: data["tx_dropped"], + RxBytes: data["tx_bytes"], + RxPackets: data["tx_packets"], + RxErrors: data["tx_errors"], + RxDropped: data["tx_dropped"], + TxBytes: data["rx_bytes"], + TxPackets: data["rx_packets"], + TxErrors: data["rx_errors"], + TxDropped: data["rx_dropped"], }, nil }