move TCP and TCP6 stats to NetworkStats

This commit is contained in:
Florian Koch 2015-09-25 09:04:53 +02:00
parent dd041457b5
commit e4262b91b1
3 changed files with 12 additions and 19 deletions

View File

@ -102,14 +102,14 @@ func GetStats(cgroupManager cgroups.Manager, rootFs string, pid int) (*info.Cont
if err != nil { if err != nil {
glog.V(2).Infof("Unable to get tcp stats from pid %d: %v", pid, err) glog.V(2).Infof("Unable to get tcp stats from pid %d: %v", pid, err)
} else { } else {
stats.TcpStat.Tcp = t stats.Network.Tcp = t
} }
t6, err := tcpStatsFromProc(rootFs, pid, "net/tcp6") t6, err := tcpStatsFromProc(rootFs, pid, "net/tcp6")
if err != nil { if err != nil {
glog.V(2).Infof("Unable to get tcp6 stats from pid %d: %v", pid, err) glog.V(2).Infof("Unable to get tcp6 stats from pid %d: %v", pid, err)
} else { } else {
stats.TcpStat.Tcp6 = t6 stats.Network.Tcp6 = t6
} }
} }

View File

@ -345,6 +345,10 @@ type InterfaceStats struct {
type NetworkStats struct { type NetworkStats struct {
InterfaceStats `json:",inline"` InterfaceStats `json:",inline"`
Interfaces []InterfaceStats `json:"interfaces,omitempty"` Interfaces []InterfaceStats `json:"interfaces,omitempty"`
// TCP connection stats (Established, Listen...)
Tcp TcpStat `json:"tcp"`
// TCP6 connection stats (Established, Listen...)
Tcp6 TcpStat `json:"tcp6"`
} }
type TcpStat struct { type TcpStat struct {
@ -372,11 +376,6 @@ type TcpStat struct {
Closing uint64 Closing uint64
} }
type TcpStats struct {
Tcp TcpStat `json:"tcp"`
Tcp6 TcpStat `json:"tcp6"`
}
type FsStats struct { type FsStats struct {
// The block device name associated with the filesystem. // The block device name associated with the filesystem.
Device string `json:"device,omitempty"` Device string `json:"device,omitempty"`
@ -459,9 +458,6 @@ type ContainerStats struct {
// Task load stats // Task load stats
TaskStats LoadStats `json:"task_stats,omitempty"` TaskStats LoadStats `json:"task_stats,omitempty"`
//TCP statistics
TcpStat TcpStats `json:"tcpstat,omitempty"`
//Custom metrics from all collectors //Custom metrics from all collectors
CustomMetrics map[string][]MetricVal `json:"custom_metrics,omitempty"` CustomMetrics map[string][]MetricVal `json:"custom_metrics,omitempty"`
} }

View File

@ -109,8 +109,6 @@ type ContainerStats struct {
// Task load statistics // Task load statistics
HasLoad bool `json:"has_load"` HasLoad bool `json:"has_load"`
Load v1.LoadStats `json:"load_stats,omitempty"` Load v1.LoadStats `json:"load_stats,omitempty"`
//TCP statistics
TcpStat TcpStats `json:"tcpstat,omitempty"`
// Custom Metrics // Custom Metrics
HasCustomMetrics bool `json:"has_custom_metrics"` HasCustomMetrics bool `json:"has_custom_metrics"`
CustomMetrics map[string][]v1.MetricVal `json:"custom_metrics,omitempty"` CustomMetrics map[string][]v1.MetricVal `json:"custom_metrics,omitempty"`
@ -208,11 +206,6 @@ type ProcessInfo struct {
Cmd string `json:"cmd"` Cmd string `json:"cmd"`
} }
type NetworkStats struct {
// Network stats by interface.
Interfaces []v1.InterfaceStats `json:"interfaces,omitempty"`
}
type TcpStat struct { type TcpStat struct {
Established uint64 Established uint64
SynSent uint64 SynSent uint64
@ -227,8 +220,12 @@ type TcpStat struct {
Closing uint64 Closing uint64
} }
type TcpStats struct { type NetworkStats struct {
Tcp TcpStat `json:"tcp"` // Network stats by interface.
Interfaces []v1.InterfaceStats `json:"interfaces,omitempty"`
// TCP connection stats (Established, Listen...)
Tcp TcpStat `json:"tcp"`
// TCP6 connection stats (Established, Listen...)
Tcp6 TcpStat `json:"tcp6"` Tcp6 TcpStat `json:"tcp6"`
} }