Fix veth network stats. Tx on the host vETH is ingress traffic and not egress.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
This commit is contained in:
Vishnu Kannan 2014-07-24 00:26:13 +00:00
parent 6777537b30
commit 47096e1ffd
1 changed files with 9 additions and 8 deletions

View File

@ -30,15 +30,16 @@ func GetStats(networkState *NetworkState) (*NetworkStats, error) {
return nil, err 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{ return &NetworkStats{
RxBytes: data["rx_bytes"], RxBytes: data["tx_bytes"],
RxPackets: data["rx_packets"], RxPackets: data["tx_packets"],
RxErrors: data["rx_errors"], RxErrors: data["tx_errors"],
RxDropped: data["rx_dropped"], RxDropped: data["tx_dropped"],
TxBytes: data["tx_bytes"], TxBytes: data["rx_bytes"],
TxPackets: data["tx_packets"], TxPackets: data["rx_packets"],
TxErrors: data["tx_errors"], TxErrors: data["rx_errors"],
TxDropped: data["tx_dropped"], TxDropped: data["rx_dropped"],
}, nil }, nil
} }