Skip to content

Commit

Permalink
Fix veth network stats. Tx on the host vETH is ingress traffic and no…
Browse files Browse the repository at this point in the history
…t egress.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
  • Loading branch information
vishh committed Jul 24, 2014
1 parent 6777537 commit 47096e1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions network/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 47096e1

Please sign in to comment.