split advanced tcp metrics from original tcp metrics as advtcp

This commit is contained in:
ChenQingya 2020-01-07 12:04:35 +08:00
parent 0a9365b238
commit 43e78242ea
8 changed files with 177 additions and 161 deletions

View File

@ -77,22 +77,24 @@ var (
// Metrics to be ignored. // Metrics to be ignored.
// Tcp metrics are ignored by default. // Tcp metrics are ignored by default.
ignoreMetrics metricSetValue = metricSetValue{container.MetricSet{ ignoreMetrics metricSetValue = metricSetValue{container.MetricSet{
container.NetworkTcpUsageMetrics: struct{}{}, container.NetworkTcpUsageMetrics: struct{}{},
container.NetworkUdpUsageMetrics: struct{}{}, container.NetworkUdpUsageMetrics: struct{}{},
container.ProcessSchedulerMetrics: struct{}{}, container.NetworkAdvancedTcpUsageMetrics: struct{}{},
container.ProcessMetrics: struct{}{}, container.ProcessSchedulerMetrics: struct{}{},
container.ProcessMetrics: struct{}{},
}} }}
// List of metrics that can be ignored. // List of metrics that can be ignored.
ignoreWhitelist = container.MetricSet{ ignoreWhitelist = container.MetricSet{
container.DiskUsageMetrics: struct{}{}, container.DiskUsageMetrics: struct{}{},
container.DiskIOMetrics: struct{}{}, container.DiskIOMetrics: struct{}{},
container.NetworkUsageMetrics: struct{}{}, container.NetworkUsageMetrics: struct{}{},
container.NetworkTcpUsageMetrics: struct{}{}, container.NetworkTcpUsageMetrics: struct{}{},
container.NetworkUdpUsageMetrics: struct{}{}, container.NetworkAdvancedTcpUsageMetrics: struct{}{},
container.PerCpuUsageMetrics: struct{}{}, container.NetworkUdpUsageMetrics: struct{}{},
container.ProcessSchedulerMetrics: struct{}{}, container.PerCpuUsageMetrics: struct{}{},
container.ProcessMetrics: struct{}{}, container.ProcessSchedulerMetrics: struct{}{},
container.ProcessMetrics: struct{}{},
} }
) )
@ -269,6 +271,7 @@ func toIncludedMetrics(ignoreMetrics container.MetricSet) container.MetricSet {
container.DiskUsageMetrics, container.DiskUsageMetrics,
container.NetworkUsageMetrics, container.NetworkUsageMetrics,
container.NetworkTcpUsageMetrics, container.NetworkTcpUsageMetrics,
container.NetworkAdvancedTcpUsageMetrics,
container.NetworkUdpUsageMetrics, container.NetworkUdpUsageMetrics,
container.AcceleratorUsageMetrics, container.AcceleratorUsageMetrics,
container.AppMetrics, container.AppMetrics,

View File

@ -28,6 +28,12 @@ func TestTcpMetricsAreDisabledByDefault(t *testing.T) {
assert.True(t, ignoreMetrics.Has(container.NetworkTcpUsageMetrics)) assert.True(t, ignoreMetrics.Has(container.NetworkTcpUsageMetrics))
} }
func TestAdvancedTcpMetricsAreDisabledByDefault(t *testing.T) {
assert.True(t, ignoreMetrics.Has(container.NetworkAdvancedTcpUsageMetrics))
flag.Parse()
assert.True(t, ignoreMetrics.Has(container.NetworkAdvancedTcpUsageMetrics))
}
func TestUdpMetricsAreDisabledByDefault(t *testing.T) { func TestUdpMetricsAreDisabledByDefault(t *testing.T) {
assert.True(t, ignoreMetrics.Has(container.NetworkUdpUsageMetrics)) assert.True(t, ignoreMetrics.Has(container.NetworkUdpUsageMetrics))
flag.Parse() flag.Parse()

View File

@ -43,19 +43,20 @@ type ContainerHandlerFactory interface {
type MetricKind string type MetricKind string
const ( const (
CpuUsageMetrics MetricKind = "cpu" CpuUsageMetrics MetricKind = "cpu"
ProcessSchedulerMetrics MetricKind = "sched" ProcessSchedulerMetrics MetricKind = "sched"
PerCpuUsageMetrics MetricKind = "percpu" PerCpuUsageMetrics MetricKind = "percpu"
MemoryUsageMetrics MetricKind = "memory" MemoryUsageMetrics MetricKind = "memory"
CpuLoadMetrics MetricKind = "cpuLoad" CpuLoadMetrics MetricKind = "cpuLoad"
DiskIOMetrics MetricKind = "diskIO" DiskIOMetrics MetricKind = "diskIO"
DiskUsageMetrics MetricKind = "disk" DiskUsageMetrics MetricKind = "disk"
NetworkUsageMetrics MetricKind = "network" NetworkUsageMetrics MetricKind = "network"
NetworkTcpUsageMetrics MetricKind = "tcp" NetworkTcpUsageMetrics MetricKind = "tcp"
NetworkUdpUsageMetrics MetricKind = "udp" NetworkAdvancedTcpUsageMetrics MetricKind = "advtcp"
AcceleratorUsageMetrics MetricKind = "accelerator" NetworkUdpUsageMetrics MetricKind = "udp"
AppMetrics MetricKind = "app" AcceleratorUsageMetrics MetricKind = "accelerator"
ProcessMetrics MetricKind = "process" AppMetrics MetricKind = "app"
ProcessMetrics MetricKind = "process"
) )
func (mk MetricKind) String() string { func (mk MetricKind) String() string {

View File

@ -107,11 +107,14 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
} else { } else {
stats.Network.Tcp6 = t6 stats.Network.Tcp6 = t6
} }
ta, err := advanceTcpStatsFromProc(h.rootFs, h.pid, "net/netstat", "net/snmp")
}
if h.includedMetrics.Has(container.NetworkAdvancedTcpUsageMetrics) {
ta, err := advancedTcpStatsFromProc(h.rootFs, h.pid, "net/netstat", "net/snmp")
if err != nil { if err != nil {
klog.V(4).Infof("Unable to get advance tcp stats from pid %d: %v", h.pid, err) klog.V(4).Infof("Unable to get advanced tcp stats from pid %d: %v", h.pid, err)
} else { } else {
stats.Network.TcpAdvance = ta stats.Network.TcpAdvanced = ta
} }
} }
if h.includedMetrics.Has(container.NetworkUdpUsageMetrics) { if h.includedMetrics.Has(container.NetworkUdpUsageMetrics) {
@ -415,36 +418,36 @@ func tcpStatsFromProc(rootFs string, pid int, file string) (info.TcpStat, error)
return tcpStats, nil return tcpStats, nil
} }
func advanceTcpStatsFromProc(rootFs string, pid int, file1, file2 string) (info.TcpAdvanceStat, error) { func advancedTcpStatsFromProc(rootFs string, pid int, file1, file2 string) (info.TcpAdvancedStat, error) {
var advanceStats info.TcpAdvanceStat var advancedStats info.TcpAdvancedStat
var err error var err error
netstatFile := path.Join(rootFs, "proc", strconv.Itoa(pid), file1) netstatFile := path.Join(rootFs, "proc", strconv.Itoa(pid), file1)
err = scanAdvanceTcpStats(&advanceStats, netstatFile) err = scanAdvancedTcpStats(&advancedStats, netstatFile)
if err != nil { if err != nil {
return advanceStats, err return advancedStats, err
} }
snmpFile := path.Join(rootFs, "proc", strconv.Itoa(pid), file2) snmpFile := path.Join(rootFs, "proc", strconv.Itoa(pid), file2)
err = scanAdvanceTcpStats(&advanceStats, snmpFile) err = scanAdvancedTcpStats(&advancedStats, snmpFile)
if err != nil { if err != nil {
return advanceStats, err return advancedStats, err
} }
return advanceStats, nil return advancedStats, nil
} }
func scanAdvanceTcpStats(advanceStats *info.TcpAdvanceStat, advanceTcpStatsFile string) error { func scanAdvancedTcpStats(advancedStats *info.TcpAdvancedStat, advancedTcpStatsFile string) error {
data, err := ioutil.ReadFile(advanceTcpStatsFile) data, err := ioutil.ReadFile(advancedTcpStatsFile)
if err != nil { if err != nil {
return fmt.Errorf("failure opening %s: %v", advanceTcpStatsFile, err) return fmt.Errorf("failure opening %s: %v", advancedTcpStatsFile, err)
} }
reader := strings.NewReader(string(data)) reader := strings.NewReader(string(data))
scanner := bufio.NewScanner(reader) scanner := bufio.NewScanner(reader)
scanner.Split(bufio.ScanLines) scanner.Split(bufio.ScanLines)
advanceTcpStats := make(map[string]interface{}) advancedTcpStats := make(map[string]interface{})
for scanner.Scan() { for scanner.Scan() {
nameParts := strings.Split(scanner.Text(), " ") nameParts := strings.Split(scanner.Text(), " ")
scanner.Scan() scanner.Scan()
@ -456,7 +459,7 @@ func scanAdvanceTcpStats(advanceStats *info.TcpAdvanceStat, advanceTcpStatsFile
} }
if len(nameParts) != len(valueParts) { if len(nameParts) != len(valueParts) {
return fmt.Errorf("mismatch field count mismatch in %s: %s", return fmt.Errorf("mismatch field count mismatch in %s: %s",
advanceTcpStatsFile, protocol) advancedTcpStatsFile, protocol)
} }
for i := 1; i < len(nameParts); i++ { for i := 1; i < len(nameParts); i++ {
if strings.Contains(valueParts[i], "-") { if strings.Contains(valueParts[i], "-") {
@ -464,23 +467,23 @@ func scanAdvanceTcpStats(advanceStats *info.TcpAdvanceStat, advanceTcpStatsFile
if err != nil { if err != nil {
return fmt.Errorf("decode value: %s to int64 error: %s", valueParts[i], err) return fmt.Errorf("decode value: %s to int64 error: %s", valueParts[i], err)
} }
advanceTcpStats[nameParts[i]] = vInt64 advancedTcpStats[nameParts[i]] = vInt64
} else { } else {
vUint64, err := strconv.ParseUint(valueParts[i], 10, 64) vUint64, err := strconv.ParseUint(valueParts[i], 10, 64)
if err != nil { if err != nil {
return fmt.Errorf("decode value: %s to uint64 error: %s", valueParts[i], err) return fmt.Errorf("decode value: %s to uint64 error: %s", valueParts[i], err)
} }
advanceTcpStats[nameParts[i]] = vUint64 advancedTcpStats[nameParts[i]] = vUint64
} }
} }
} }
b, err := json.Marshal(advanceTcpStats) b, err := json.Marshal(advancedTcpStats)
if err != nil { if err != nil {
return err return err
} }
err = json.Unmarshal(b, advanceStats) err = json.Unmarshal(b, advancedStats)
if err != nil { if err != nil {
return err return err
} }

View File

@ -416,8 +416,8 @@ type NetworkStats struct {
Udp UdpStat `json:"udp"` Udp UdpStat `json:"udp"`
// UDP6 connection stats // UDP6 connection stats
Udp6 UdpStat `json:"udp6"` Udp6 UdpStat `json:"udp6"`
// Advance TCP stats // TCP advanced stats
TcpAdvance TcpAdvanceStat `json:"tcp_advance"` TcpAdvanced TcpAdvancedStat `json:"tcp_advanced"`
} }
type TcpStat struct { type TcpStat struct {
@ -445,7 +445,7 @@ type TcpStat struct {
Closing uint64 Closing uint64
} }
type TcpAdvanceStat struct { type TcpAdvancedStat struct {
// The algorithm used to determine the timeout value used for // The algorithm used to determine the timeout value used for
// retransmitting unacknowledged octets, ref: RFC2698, default 1 // retransmitting unacknowledged octets, ref: RFC2698, default 1
RtoAlgorithm uint64 RtoAlgorithm uint64

View File

@ -290,8 +290,8 @@ type NetworkStats struct {
Udp v1.UdpStat `json:"udp"` Udp v1.UdpStat `json:"udp"`
// UDP6 connection stats // UDP6 connection stats
Udp6 v1.UdpStat `json:"udp6"` Udp6 v1.UdpStat `json:"udp6"`
// Advance TCP stats // TCP advanced stats
TcpAdvance v1.TcpAdvanceStat `json:"tcp_advance"` TcpAdvanced v1.TcpAdvancedStat `json:"tcp_advanced"`
} }
// Instantaneous CPU stats // Instantaneous CPU stats

View File

@ -960,6 +960,8 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetri
}, },
}, },
}...) }...)
}
if includedMetrics.Has(container.NetworkAdvancedTcpUsageMetrics) {
c.containerMetrics = append(c.containerMetrics, []containerMetric{ c.containerMetrics = append(c.containerMetrics, []containerMetric{
{ {
name: "container_network_advance_tcp_stats_total", name: "container_network_advance_tcp_stats_total",
@ -969,399 +971,399 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetri
getValues: func(s *info.ContainerStats) metricValues { getValues: func(s *info.ContainerStats) metricValues {
return metricValues{ return metricValues{
{ {
value: float64(s.Network.TcpAdvance.RtoAlgorithm), value: float64(s.Network.TcpAdvanced.RtoAlgorithm),
labels: []string{"rtoalgorithm"}, labels: []string{"rtoalgorithm"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.RtoMin), value: float64(s.Network.TcpAdvanced.RtoMin),
labels: []string{"rtomin"}, labels: []string{"rtomin"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.RtoMax), value: float64(s.Network.TcpAdvanced.RtoMax),
labels: []string{"rtomax"}, labels: []string{"rtomax"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.MaxConn), value: float64(s.Network.TcpAdvanced.MaxConn),
labels: []string{"maxconn"}, labels: []string{"maxconn"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.ActiveOpens), value: float64(s.Network.TcpAdvanced.ActiveOpens),
labels: []string{"activeopens"}, labels: []string{"activeopens"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.PassiveOpens), value: float64(s.Network.TcpAdvanced.PassiveOpens),
labels: []string{"passiveopens"}, labels: []string{"passiveopens"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.AttemptFails), value: float64(s.Network.TcpAdvanced.AttemptFails),
labels: []string{"attemptfails"}, labels: []string{"attemptfails"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.EstabResets), value: float64(s.Network.TcpAdvanced.EstabResets),
labels: []string{"estabresets"}, labels: []string{"estabresets"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.CurrEstab), value: float64(s.Network.TcpAdvanced.CurrEstab),
labels: []string{"currestab"}, labels: []string{"currestab"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.InSegs), value: float64(s.Network.TcpAdvanced.InSegs),
labels: []string{"insegs"}, labels: []string{"insegs"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.OutSegs), value: float64(s.Network.TcpAdvanced.OutSegs),
labels: []string{"outsegs"}, labels: []string{"outsegs"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.RetransSegs), value: float64(s.Network.TcpAdvanced.RetransSegs),
labels: []string{"retranssegs"}, labels: []string{"retranssegs"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.InErrs), value: float64(s.Network.TcpAdvanced.InErrs),
labels: []string{"inerrs"}, labels: []string{"inerrs"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.OutRsts), value: float64(s.Network.TcpAdvanced.OutRsts),
labels: []string{"outrsts"}, labels: []string{"outrsts"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.InCsumErrors), value: float64(s.Network.TcpAdvanced.InCsumErrors),
labels: []string{"incsumerrors"}, labels: []string{"incsumerrors"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.EmbryonicRsts), value: float64(s.Network.TcpAdvanced.EmbryonicRsts),
labels: []string{"embryonicrsts"}, labels: []string{"embryonicrsts"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.SyncookiesSent), value: float64(s.Network.TcpAdvanced.SyncookiesSent),
labels: []string{"syncookiessent"}, labels: []string{"syncookiessent"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.SyncookiesRecv), value: float64(s.Network.TcpAdvanced.SyncookiesRecv),
labels: []string{"syncookiesrecv"}, labels: []string{"syncookiesrecv"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.SyncookiesFailed), value: float64(s.Network.TcpAdvanced.SyncookiesFailed),
labels: []string{"syncookiesfailed"}, labels: []string{"syncookiesfailed"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.PruneCalled), value: float64(s.Network.TcpAdvanced.PruneCalled),
labels: []string{"prunecalled"}, labels: []string{"prunecalled"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.RcvPruned), value: float64(s.Network.TcpAdvanced.RcvPruned),
labels: []string{"rcvpruned"}, labels: []string{"rcvpruned"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.OfoPruned), value: float64(s.Network.TcpAdvanced.OfoPruned),
labels: []string{"ofopruned"}, labels: []string{"ofopruned"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.OutOfWindowIcmps), value: float64(s.Network.TcpAdvanced.OutOfWindowIcmps),
labels: []string{"outofwindowicmps"}, labels: []string{"outofwindowicmps"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.LockDroppedIcmps), value: float64(s.Network.TcpAdvanced.LockDroppedIcmps),
labels: []string{"lockdroppedicmps"}, labels: []string{"lockdroppedicmps"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TW), value: float64(s.Network.TcpAdvanced.TW),
labels: []string{"tw"}, labels: []string{"tw"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TWRecycled), value: float64(s.Network.TcpAdvanced.TWRecycled),
labels: []string{"twrecycled"}, labels: []string{"twrecycled"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TWKilled), value: float64(s.Network.TcpAdvanced.TWKilled),
labels: []string{"twkilled"}, labels: []string{"twkilled"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPTimeWaitOverflow), value: float64(s.Network.TcpAdvanced.TCPTimeWaitOverflow),
labels: []string{"tcptimewaitoverflow"}, labels: []string{"tcptimewaitoverflow"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPTimeouts), value: float64(s.Network.TcpAdvanced.TCPTimeouts),
labels: []string{"tcptimeouts"}, labels: []string{"tcptimeouts"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSpuriousRTOs), value: float64(s.Network.TcpAdvanced.TCPSpuriousRTOs),
labels: []string{"tcpspuriousrtos"}, labels: []string{"tcpspuriousrtos"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPLossProbes), value: float64(s.Network.TcpAdvanced.TCPLossProbes),
labels: []string{"tcplossprobes"}, labels: []string{"tcplossprobes"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPLossProbeRecovery), value: float64(s.Network.TcpAdvanced.TCPLossProbeRecovery),
labels: []string{"tcplossproberecovery"}, labels: []string{"tcplossproberecovery"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPRenoRecoveryFail), value: float64(s.Network.TcpAdvanced.TCPRenoRecoveryFail),
labels: []string{"tcprenorecoveryfail"}, labels: []string{"tcprenorecoveryfail"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSackRecoveryFail), value: float64(s.Network.TcpAdvanced.TCPSackRecoveryFail),
labels: []string{"tcpsackrecoveryfail"}, labels: []string{"tcpsackrecoveryfail"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPRenoFailures), value: float64(s.Network.TcpAdvanced.TCPRenoFailures),
labels: []string{"tcprenofailures"}, labels: []string{"tcprenofailures"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSackFailures), value: float64(s.Network.TcpAdvanced.TCPSackFailures),
labels: []string{"tcpsackfailures"}, labels: []string{"tcpsackfailures"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPLossFailures), value: float64(s.Network.TcpAdvanced.TCPLossFailures),
labels: []string{"tcplossfailures"}, labels: []string{"tcplossfailures"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.DelayedACKs), value: float64(s.Network.TcpAdvanced.DelayedACKs),
labels: []string{"delayedacks"}, labels: []string{"delayedacks"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.DelayedACKLocked), value: float64(s.Network.TcpAdvanced.DelayedACKLocked),
labels: []string{"delayedacklocked"}, labels: []string{"delayedacklocked"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.DelayedACKLost), value: float64(s.Network.TcpAdvanced.DelayedACKLost),
labels: []string{"delayedacklost"}, labels: []string{"delayedacklost"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.ListenOverflows), value: float64(s.Network.TcpAdvanced.ListenOverflows),
labels: []string{"listenoverflows"}, labels: []string{"listenoverflows"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.ListenDrops), value: float64(s.Network.TcpAdvanced.ListenDrops),
labels: []string{"listendrops"}, labels: []string{"listendrops"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPHPHits), value: float64(s.Network.TcpAdvanced.TCPHPHits),
labels: []string{"tcphphits"}, labels: []string{"tcphphits"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPPureAcks), value: float64(s.Network.TcpAdvanced.TCPPureAcks),
labels: []string{"tcppureacks"}, labels: []string{"tcppureacks"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPHPAcks), value: float64(s.Network.TcpAdvanced.TCPHPAcks),
labels: []string{"tcphpacks"}, labels: []string{"tcphpacks"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPRenoRecovery), value: float64(s.Network.TcpAdvanced.TCPRenoRecovery),
labels: []string{"tcprenorecovery"}, labels: []string{"tcprenorecovery"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSackRecovery), value: float64(s.Network.TcpAdvanced.TCPSackRecovery),
labels: []string{"tcpsackrecovery"}, labels: []string{"tcpsackrecovery"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSACKReneging), value: float64(s.Network.TcpAdvanced.TCPSACKReneging),
labels: []string{"tcpsackreneging"}, labels: []string{"tcpsackreneging"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFACKReorder), value: float64(s.Network.TcpAdvanced.TCPFACKReorder),
labels: []string{"tcpfackreorder"}, labels: []string{"tcpfackreorder"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSACKReorder), value: float64(s.Network.TcpAdvanced.TCPSACKReorder),
labels: []string{"tcpsackreorder"}, labels: []string{"tcpsackreorder"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPRenoReorder), value: float64(s.Network.TcpAdvanced.TCPRenoReorder),
labels: []string{"tcprenoreorder"}, labels: []string{"tcprenoreorder"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPTSReorder), value: float64(s.Network.TcpAdvanced.TCPTSReorder),
labels: []string{"tcptsreorder"}, labels: []string{"tcptsreorder"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFullUndo), value: float64(s.Network.TcpAdvanced.TCPFullUndo),
labels: []string{"tcpfullundo"}, labels: []string{"tcpfullundo"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPPartialUndo), value: float64(s.Network.TcpAdvanced.TCPPartialUndo),
labels: []string{"tcppartialundo"}, labels: []string{"tcppartialundo"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPDSACKUndo), value: float64(s.Network.TcpAdvanced.TCPDSACKUndo),
labels: []string{"tcpdsackundo"}, labels: []string{"tcpdsackundo"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPLossUndo), value: float64(s.Network.TcpAdvanced.TCPLossUndo),
labels: []string{"tcplossundo"}, labels: []string{"tcplossundo"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFastRetrans), value: float64(s.Network.TcpAdvanced.TCPFastRetrans),
labels: []string{"tcpfastretrans"}, labels: []string{"tcpfastretrans"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSlowStartRetrans), value: float64(s.Network.TcpAdvanced.TCPSlowStartRetrans),
labels: []string{"tcpslowstartretrans"}, labels: []string{"tcpslowstartretrans"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPLostRetransmit), value: float64(s.Network.TcpAdvanced.TCPLostRetransmit),
labels: []string{"tcplostretransmit"}, labels: []string{"tcplostretransmit"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPRetransFail), value: float64(s.Network.TcpAdvanced.TCPRetransFail),
labels: []string{"tcpretransfail"}, labels: []string{"tcpretransfail"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPRcvCollapsed), value: float64(s.Network.TcpAdvanced.TCPRcvCollapsed),
labels: []string{"tcprcvcollapsed"}, labels: []string{"tcprcvcollapsed"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPDSACKOldSent), value: float64(s.Network.TcpAdvanced.TCPDSACKOldSent),
labels: []string{"tcpdsackoldsent"}, labels: []string{"tcpdsackoldsent"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPDSACKOfoSent), value: float64(s.Network.TcpAdvanced.TCPDSACKOfoSent),
labels: []string{"tcpdsackofosent"}, labels: []string{"tcpdsackofosent"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPDSACKRecv), value: float64(s.Network.TcpAdvanced.TCPDSACKRecv),
labels: []string{"tcpdsackrecv"}, labels: []string{"tcpdsackrecv"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPDSACKOfoRecv), value: float64(s.Network.TcpAdvanced.TCPDSACKOfoRecv),
labels: []string{"tcpdsackoforecv"}, labels: []string{"tcpdsackoforecv"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPAbortOnData), value: float64(s.Network.TcpAdvanced.TCPAbortOnData),
labels: []string{"tcpabortondata"}, labels: []string{"tcpabortondata"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPAbortOnClose), value: float64(s.Network.TcpAdvanced.TCPAbortOnClose),
labels: []string{"tcpabortonclose"}, labels: []string{"tcpabortonclose"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPAbortOnMemory), value: float64(s.Network.TcpAdvanced.TCPAbortOnMemory),
labels: []string{"tcpabortonmemory"}, labels: []string{"tcpabortonmemory"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPAbortOnTimeout), value: float64(s.Network.TcpAdvanced.TCPAbortOnTimeout),
labels: []string{"tcpabortontimeout"}, labels: []string{"tcpabortontimeout"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPAbortOnLinger), value: float64(s.Network.TcpAdvanced.TCPAbortOnLinger),
labels: []string{"tcpabortonlinger"}, labels: []string{"tcpabortonlinger"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPAbortFailed), value: float64(s.Network.TcpAdvanced.TCPAbortFailed),
labels: []string{"tcpabortfailed"}, labels: []string{"tcpabortfailed"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPMemoryPressures), value: float64(s.Network.TcpAdvanced.TCPMemoryPressures),
labels: []string{"tcpmemorypressures"}, labels: []string{"tcpmemorypressures"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPMemoryPressuresChrono), value: float64(s.Network.TcpAdvanced.TCPMemoryPressuresChrono),
labels: []string{"tcpmemorypressureschrono"}, labels: []string{"tcpmemorypressureschrono"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSACKDiscard), value: float64(s.Network.TcpAdvanced.TCPSACKDiscard),
labels: []string{"tcpsackdiscard"}, labels: []string{"tcpsackdiscard"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPDSACKIgnoredOld), value: float64(s.Network.TcpAdvanced.TCPDSACKIgnoredOld),
labels: []string{"tcpdsackignoredold"}, labels: []string{"tcpdsackignoredold"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPDSACKIgnoredNoUndo), value: float64(s.Network.TcpAdvanced.TCPDSACKIgnoredNoUndo),
labels: []string{"tcpdsackignorednoundo"}, labels: []string{"tcpdsackignorednoundo"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPMD5NotFound), value: float64(s.Network.TcpAdvanced.TCPMD5NotFound),
labels: []string{"tcpmd5notfound"}, labels: []string{"tcpmd5notfound"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPMD5Unexpected), value: float64(s.Network.TcpAdvanced.TCPMD5Unexpected),
labels: []string{"tcpmd5unexpected"}, labels: []string{"tcpmd5unexpected"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPMD5Failure), value: float64(s.Network.TcpAdvanced.TCPMD5Failure),
labels: []string{"tcpmd5failure"}, labels: []string{"tcpmd5failure"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSackShifted), value: float64(s.Network.TcpAdvanced.TCPSackShifted),
labels: []string{"tcpsackshifted"}, labels: []string{"tcpsackshifted"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSackMerged), value: float64(s.Network.TcpAdvanced.TCPSackMerged),
labels: []string{"tcpsackmerged"}, labels: []string{"tcpsackmerged"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSackShiftFallback), value: float64(s.Network.TcpAdvanced.TCPSackShiftFallback),
labels: []string{"tcpsackshiftfallback"}, labels: []string{"tcpsackshiftfallback"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPBacklogDrop), value: float64(s.Network.TcpAdvanced.TCPBacklogDrop),
labels: []string{"tcpbacklogdrop"}, labels: []string{"tcpbacklogdrop"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.PFMemallocDrop), value: float64(s.Network.TcpAdvanced.PFMemallocDrop),
labels: []string{"pfmemallocdrop"}, labels: []string{"pfmemallocdrop"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPMinTTLDrop), value: float64(s.Network.TcpAdvanced.TCPMinTTLDrop),
labels: []string{"tcpminttldrop"}, labels: []string{"tcpminttldrop"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPDeferAcceptDrop), value: float64(s.Network.TcpAdvanced.TCPDeferAcceptDrop),
labels: []string{"tcpdeferacceptdrop"}, labels: []string{"tcpdeferacceptdrop"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.IPReversePathFilter), value: float64(s.Network.TcpAdvanced.IPReversePathFilter),
labels: []string{"ipreversepathfilter"}, labels: []string{"ipreversepathfilter"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPReqQFullDoCookies), value: float64(s.Network.TcpAdvanced.TCPReqQFullDoCookies),
labels: []string{"tcpreqqfulldocookies"}, labels: []string{"tcpreqqfulldocookies"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPReqQFullDrop), value: float64(s.Network.TcpAdvanced.TCPReqQFullDrop),
labels: []string{"tcpreqqfulldrop"}, labels: []string{"tcpreqqfulldrop"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFastOpenActive), value: float64(s.Network.TcpAdvanced.TCPFastOpenActive),
labels: []string{"tcpfastopenactive"}, labels: []string{"tcpfastopenactive"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFastOpenActiveFail), value: float64(s.Network.TcpAdvanced.TCPFastOpenActiveFail),
labels: []string{"tcpfastopenactivefail"}, labels: []string{"tcpfastopenactivefail"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFastOpenPassive), value: float64(s.Network.TcpAdvanced.TCPFastOpenPassive),
labels: []string{"tcpfastopenpassive"}, labels: []string{"tcpfastopenpassive"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFastOpenPassiveFail), value: float64(s.Network.TcpAdvanced.TCPFastOpenPassiveFail),
labels: []string{"tcpfastopenpassivefail"}, labels: []string{"tcpfastopenpassivefail"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFastOpenListenOverflow), value: float64(s.Network.TcpAdvanced.TCPFastOpenListenOverflow),
labels: []string{"tcpfastopenlistenoverflow"}, labels: []string{"tcpfastopenlistenoverflow"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPFastOpenCookieReqd), value: float64(s.Network.TcpAdvanced.TCPFastOpenCookieReqd),
labels: []string{"tcpfastopencookiereqd"}, labels: []string{"tcpfastopencookiereqd"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPSynRetrans), value: float64(s.Network.TcpAdvanced.TCPSynRetrans),
labels: []string{"tcpsynretrans"}, labels: []string{"tcpsynretrans"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.TCPOrigDataSent), value: float64(s.Network.TcpAdvanced.TCPOrigDataSent),
labels: []string{"tcporigdatasent"}, labels: []string{"tcporigdatasent"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.PAWSActive), value: float64(s.Network.TcpAdvanced.PAWSActive),
labels: []string{"pawsactive"}, labels: []string{"pawsactive"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, { }, {
value: float64(s.Network.TcpAdvance.PAWSEstab), value: float64(s.Network.TcpAdvanced.PAWSEstab),
labels: []string{"pawsestab"}, labels: []string{"pawsestab"},
timestamp: s.Timestamp, timestamp: s.Timestamp,
}, },

View File

@ -49,18 +49,19 @@ func (p testSubcontainersInfoProvider) GetMachineInfo() (*info.MachineInfo, erro
} }
var allMetrics = container.MetricSet{ var allMetrics = container.MetricSet{
container.CpuUsageMetrics: struct{}{}, container.CpuUsageMetrics: struct{}{},
container.ProcessSchedulerMetrics: struct{}{}, container.ProcessSchedulerMetrics: struct{}{},
container.PerCpuUsageMetrics: struct{}{}, container.PerCpuUsageMetrics: struct{}{},
container.MemoryUsageMetrics: struct{}{}, container.MemoryUsageMetrics: struct{}{},
container.CpuLoadMetrics: struct{}{}, container.CpuLoadMetrics: struct{}{},
container.DiskIOMetrics: struct{}{}, container.DiskIOMetrics: struct{}{},
container.AcceleratorUsageMetrics: struct{}{}, container.AcceleratorUsageMetrics: struct{}{},
container.DiskUsageMetrics: struct{}{}, container.DiskUsageMetrics: struct{}{},
container.NetworkUsageMetrics: struct{}{}, container.NetworkUsageMetrics: struct{}{},
container.NetworkTcpUsageMetrics: struct{}{}, container.NetworkTcpUsageMetrics: struct{}{},
container.NetworkUdpUsageMetrics: struct{}{}, container.NetworkAdvancedTcpUsageMetrics: struct{}{},
container.ProcessMetrics: struct{}{}, container.NetworkUdpUsageMetrics: struct{}{},
container.ProcessMetrics: struct{}{},
} }
func (p testSubcontainersInfoProvider) SubcontainersInfo(string, *info.ContainerInfoRequest) ([]*info.ContainerInfo, error) { func (p testSubcontainersInfoProvider) SubcontainersInfo(string, *info.ContainerInfoRequest) ([]*info.ContainerInfo, error) {
@ -185,7 +186,7 @@ func (p testSubcontainersInfoProvider) SubcontainersInfo(string, *info.Container
Listen: 3, Listen: 3,
Closing: 0, Closing: 0,
}, },
TcpAdvance: info.TcpAdvanceStat{ TcpAdvanced: info.TcpAdvancedStat{
TCPFullUndo: 2361, TCPFullUndo: 2361,
TCPMD5NotFound: 0, TCPMD5NotFound: 0,
TCPDSACKRecv: 83680, TCPDSACKRecv: 83680,