From 457272c4f66d3a7ebb3dd07780d6e70d5e9fb244 Mon Sep 17 00:00:00 2001 From: Random-Liu Date: Sat, 19 Nov 2016 17:44:26 -0800 Subject: [PATCH] Update godep to include cadvisor fix. --- Godeps/Godeps.json | 8 +-- .../google/cadvisor/info/v1/container.go | 54 +++++++++++++------ .../google/cadvisor/info/v1/machine.go | 3 ++ .../google/cadvisor/info/v1/metric.go | 6 +-- .../google/cadvisor/utils/tail/tail.go | 24 ++++++--- 5 files changed, 67 insertions(+), 28 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index ea56f9b7..76d53888 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -128,13 +128,13 @@ }, { "ImportPath": "github.com/google/cadvisor/info/v1", - "Comment": "v0.23.2", - "Rev": "7ddf6eb5d1f84363fbc181a498313a880b12ba07" + "Comment": "v0.24.0-alpha1-60-gb5b0547", + "Rev": "b5b0547e330937317d464f50dfe9e6f34460b125" }, { "ImportPath": "github.com/google/cadvisor/utils/tail", - "Comment": "v0.23.2", - "Rev": "7ddf6eb5d1f84363fbc181a498313a880b12ba07" + "Comment": "v0.24.0-alpha1-60-gb5b0547", + "Rev": "b5b0547e330937317d464f50dfe9e6f34460b125" }, { "ImportPath": "github.com/google/gofuzz", diff --git a/vendor/github.com/google/cadvisor/info/v1/container.go b/vendor/github.com/google/cadvisor/info/v1/container.go index 6e7e6589..6c9be7c6 100644 --- a/vendor/github.com/google/cadvisor/info/v1/container.go +++ b/vendor/github.com/google/cadvisor/info/v1/container.go @@ -266,7 +266,7 @@ type LoadStats struct { // CPU usage time statistics. type CpuUsage struct { // Total CPU usage. - // Units: nanoseconds + // Unit: nanoseconds. Total uint64 `json:"total"` // Per CPU/core usage of the container. @@ -274,17 +274,31 @@ type CpuUsage struct { PerCpu []uint64 `json:"per_cpu_usage,omitempty"` // Time spent in user space. - // Unit: nanoseconds + // Unit: nanoseconds. User uint64 `json:"user"` // Time spent in kernel space. - // Unit: nanoseconds + // Unit: nanoseconds. System uint64 `json:"system"` } +// Cpu Completely Fair Scheduler statistics. +type CpuCFS struct { + // Total number of elapsed enforcement intervals. + Periods uint64 `json:"periods"` + + // Total number of times tasks in the cgroup have been throttled. + ThrottledPeriods uint64 `json:"throttled_periods"` + + // Total time duration for which tasks in the cgroup have been throttled. + // Unit: nanoseconds. + ThrottledTime uint64 `json:"throttled_time"` +} + // All CPU usage metrics are cumulative from the creation of the container type CpuStats struct { Usage CpuUsage `json:"usage"` + CFS CpuCFS `json:"cfs"` // Smoothed average of number of runnable threads x 1000. // We multiply by thousand to avoid using floats, but preserving precision. // Load is smoothed over the last 10 seconds. Instantaneous value can be read @@ -324,6 +338,10 @@ type MemoryStats struct { // Units: Bytes. RSS uint64 `json:"rss"` + // The amount of swap currently used by the processes in this cgroup + // Units: Bytes. + Swap uint64 `json:"swap"` + // The amount of working set memory, this includes recently accessed memory, // dirty memory, and kernel memory. Working set is <= "usage". // Units: Bytes. @@ -371,27 +389,27 @@ type NetworkStats struct { } type TcpStat struct { - //Count of TCP connections in state "Established" + // Count of TCP connections in state "Established" Established uint64 - //Count of TCP connections in state "Syn_Sent" + // Count of TCP connections in state "Syn_Sent" SynSent uint64 - //Count of TCP connections in state "Syn_Recv" + // Count of TCP connections in state "Syn_Recv" SynRecv uint64 - //Count of TCP connections in state "Fin_Wait1" + // Count of TCP connections in state "Fin_Wait1" FinWait1 uint64 - //Count of TCP connections in state "Fin_Wait2" + // Count of TCP connections in state "Fin_Wait2" FinWait2 uint64 - //Count of TCP connections in state "Time_Wait + // Count of TCP connections in state "Time_Wait TimeWait uint64 - //Count of TCP connections in state "Close" + // Count of TCP connections in state "Close" Close uint64 - //Count of TCP connections in state "Close_Wait" + // Count of TCP connections in state "Close_Wait" CloseWait uint64 - //Count of TCP connections in state "Listen_Ack" + // Count of TCP connections in state "Listen_Ack" LastAck uint64 - //Count of TCP connections in state "Listen" + // Count of TCP connections in state "Listen" Listen uint64 - //Count of TCP connections in state "Closing" + // Count of TCP connections in state "Closing" Closing uint64 } @@ -415,6 +433,12 @@ type FsStats struct { // Number of bytes available for non-root user. Available uint64 `json:"available"` + // HasInodes when true, indicates that Inodes info will be available. + HasInodes bool `json:"has_inodes"` + + // Number of Inodes + Inodes uint64 `json:"inodes"` + // Number of available Inodes InodesFree uint64 `json:"inodes_free"` @@ -487,7 +511,7 @@ type ContainerStats struct { // Task load stats TaskStats LoadStats `json:"task_stats,omitempty"` - //Custom metrics from all collectors + // Custom metrics from all collectors CustomMetrics map[string][]MetricVal `json:"custom_metrics,omitempty"` } diff --git a/vendor/github.com/google/cadvisor/info/v1/machine.go b/vendor/github.com/google/cadvisor/info/v1/machine.go index 74a5df49..933b6f30 100644 --- a/vendor/github.com/google/cadvisor/info/v1/machine.go +++ b/vendor/github.com/google/cadvisor/info/v1/machine.go @@ -26,6 +26,9 @@ type FsInfo struct { // Total number of inodes available on the filesystem. Inodes uint64 `json:"inodes"` + + // HasInodes when true, indicates that Inodes info will be available. + HasInodes bool `json:"has_inodes"` } type Node struct { diff --git a/vendor/github.com/google/cadvisor/info/v1/metric.go b/vendor/github.com/google/cadvisor/info/v1/metric.go index 90fd9e49..30c23ed1 100644 --- a/vendor/github.com/google/cadvisor/info/v1/metric.go +++ b/vendor/github.com/google/cadvisor/info/v1/metric.go @@ -26,10 +26,10 @@ const ( MetricGauge MetricType = "gauge" // A counter-like value that is only expected to increase. - MetricCumulative = "cumulative" + MetricCumulative MetricType = "cumulative" // Rate over a time period. - MetricDelta = "delta" + MetricDelta MetricType = "delta" ) // DataType for metric being exported. @@ -37,7 +37,7 @@ type DataType string const ( IntType DataType = "int" - FloatType = "float" + FloatType DataType = "float" ) // Spec for custom metric. diff --git a/vendor/github.com/google/cadvisor/utils/tail/tail.go b/vendor/github.com/google/cadvisor/utils/tail/tail.go index 0219b3fb..beccee36 100644 --- a/vendor/github.com/google/cadvisor/utils/tail/tail.go +++ b/vendor/github.com/google/cadvisor/utils/tail/tail.go @@ -45,6 +45,16 @@ const ( // NewTail starts opens the given file and watches it for deletion/rotation func NewTail(filename string) (*Tail, error) { + t, err := newTail(filename) + if err != nil { + return nil, err + } + go t.watchLoop() + return t, nil +} + +// newTail creates a Tail object. +func newTail(filename string) (*Tail, error) { t := &Tail{ filename: filename, } @@ -54,7 +64,9 @@ func NewTail(filename string) (*Tail, error) { if err != nil { return nil, fmt.Errorf("inotify init failed on %s: %v", t.filename, err) } - go t.watchLoop() + // Initialize readerErr as io.EOF, so that the reader can work properly + // during initialization. + t.readerErr = io.EOF return t, nil } @@ -62,23 +74,23 @@ func NewTail(filename string) (*Tail, error) { func (t *Tail) Read(p []byte) (int, error) { t.readerLock.RLock() defer t.readerLock.RUnlock() - if t.reader == nil || t.readerErr != nil { + if t.readerErr != nil { return 0, t.readerErr } return t.reader.Read(p) } -var _ io.Reader = &Tail{} +var _ io.ReadCloser = &Tail{} // Close stops watching and closes the file -func (t *Tail) Close() { +func (t *Tail) Close() error { close(t.stop) + return nil } func (t *Tail) attemptOpen() error { t.readerLock.Lock() defer t.readerLock.Unlock() - t.reader = nil t.readerErr = nil attempt := 0 for interval := defaultRetryInterval; ; interval *= 2 { @@ -88,7 +100,7 @@ func (t *Tail) attemptOpen() error { t.file, err = os.Open(t.filename) if err == nil { // TODO: not interested in old events? - //t.file.Seek(0, os.SEEK_END) + // t.file.Seek(0, os.SEEK_END) t.reader = bufio.NewReader(t.file) return nil }