Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
55d167d1
Commit
55d167d1
authored
May 07, 2015
by
Victor Marmol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update cAdvisor dependency.
- Better handling of time-based queries - Better handling of errors detecting machine topology Fixes #7906
parent
5074e98e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
63 deletions
+82
-63
Godeps.json
Godeps/Godeps.json
+43
-43
handler.go
...e/src/github.com/google/cadvisor/container/raw/handler.go
+5
-1
handler_test.go
...ace/src/github.com/google/cadvisor/events/handler_test.go
+3
-3
machine.go
...rkspace/src/github.com/google/cadvisor/manager/machine.go
+2
-1
timed_store.go
...space/src/github.com/google/cadvisor/utils/timed_store.go
+29
-15
No files found.
Godeps/Godeps.json
View file @
55d167d1
...
...
@@ -201,97 +201,97 @@
},
{
"ImportPath"
:
"github.com/google/cadvisor/api"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/collector"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/container"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/events"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/fs"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/healthz"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/http"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/info/v1"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/info/v2"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/manager"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/metrics"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/pages"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/storage"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/summary"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/utils"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/validate"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/cadvisor/version"
,
"Comment"
:
"0.13.0-
22-ge3aa15a
"
,
"Rev"
:
"
e3aa15a3bbee5367532ac56aa55be41441c55356
"
},
{
"ImportPath"
:
"github.com/google/go-github/github"
,
"Rev"
:
"930e6fdb8dc2b11458fdeb55b3cd68e5370a1a28"
},
{
"ImportPath"
:
"github.com/google/go-querystring/query"
,
"Rev"
:
"547ef5ac979778feb2f760cdb5f4eae1a2207b86"
},
"Comment"
:
"0.13.0-
32-g832c6e9
"
,
"Rev"
:
"
832c6e94c325ecdf05da884880c503be45594818
"
},
{
"ImportPath"
:
"github.com/google/go-github/github"
,
"Rev"
:
"930e6fdb8dc2b11458fdeb55b3cd68e5370a1a28"
},
{
"ImportPath"
:
"github.com/google/go-querystring/query"
,
"Rev"
:
"547ef5ac979778feb2f760cdb5f4eae1a2207b86"
},
{
"ImportPath"
:
"github.com/google/gofuzz"
,
"Rev"
:
"bbcb9da2d746f8bdbd6a936686a0a6067ada0ec5"
...
...
Godeps/_workspace/src/github.com/google/cadvisor/container/raw/handler.go
View file @
55d167d1
...
...
@@ -177,7 +177,11 @@ func (self *rawContainerHandler) GetSpec() (info.ContainerSpec, error) {
now
:=
time
.
Now
()
lowestTime
:=
now
for
_
,
cgroupPath
:=
range
self
.
cgroupPaths
{
// The modified time of the cgroup directory is when the container was created.
// The modified time of the cgroup directory changes whenever a subcontainer is created.
// eg. /docker will have creation time matching the creation of latest docker container.
// Use clone_children as a workaround as it isn't usually modified. It is only likely changed
// immediately after creating a container.
cgroupPath
=
path
.
Join
(
cgroupPath
,
"cgroup.clone_children"
)
fi
,
err
:=
os
.
Stat
(
cgroupPath
)
if
err
==
nil
&&
fi
.
ModTime
()
.
Before
(
lowestTime
)
{
lowestTime
=
fi
.
ModTime
()
...
...
Godeps/_workspace/src/github.com/google/cadvisor/events/handler_test.go
View file @
55d167d1
...
...
@@ -170,8 +170,8 @@ func TestGetEventsForOneEvent(t *testing.T) {
func
TestGetEventsForTimePeriod
(
t
*
testing
.
T
)
{
myEventHolder
,
myRequest
,
fakeEvent
,
fakeEvent2
:=
initializeScenario
(
t
)
myRequest
.
StartTime
=
createOldTime
(
t
)
.
Add
(
-
1
*
time
.
Second
*
10
)
myRequest
.
EndTime
=
createOldTime
(
t
)
.
Add
(
time
.
Second
*
10
)
myRequest
.
StartTime
=
time
.
Now
(
)
.
Add
(
-
1
*
time
.
Second
*
10
)
myRequest
.
EndTime
=
time
.
Now
(
)
.
Add
(
time
.
Second
*
10
)
myRequest
.
EventType
[
info
.
EventOom
]
=
true
myEventHolder
.
AddEvent
(
fakeEvent
)
...
...
@@ -181,7 +181,7 @@ func TestGetEventsForTimePeriod(t *testing.T) {
assert
.
Nil
(
t
,
err
)
checkNumberOfEvents
(
t
,
1
,
len
(
receivedEvents
))
ensureProperEventReturned
(
t
,
fakeEvent
,
receivedEvents
[
0
])
ensureProperEventReturned
(
t
,
fakeEvent
2
,
receivedEvents
[
0
])
}
func
TestGetEventsForNoTypeRequested
(
t
*
testing
.
T
)
{
...
...
Godeps/_workspace/src/github.com/google/cadvisor/manager/machine.go
View file @
55d167d1
...
...
@@ -187,7 +187,8 @@ func getTopology(sysFs sysfs.SysFs, cpuinfo string) ([]info.Node, int, error) {
for
idx
,
node
:=
range
nodes
{
caches
,
err
:=
sysinfo
.
GetCacheInfo
(
sysFs
,
node
.
Cores
[
0
]
.
Threads
[
0
])
if
err
!=
nil
{
return
nil
,
-
1
,
fmt
.
Errorf
(
"failed to get cache information for node %d: %v"
,
node
.
Id
,
err
)
glog
.
Errorf
(
"failed to get cache information for node %d: %v"
,
node
.
Id
,
err
)
continue
}
numThreadsPerCore
:=
len
(
node
.
Cores
[
0
]
.
Threads
)
numThreadsPerNode
:=
len
(
node
.
Cores
)
*
numThreadsPerCore
...
...
Godeps/_workspace/src/github.com/google/cadvisor/utils/timed_store.go
View file @
55d167d1
...
...
@@ -19,10 +19,24 @@ import (
"time"
)
type
timedStoreDataSlice
[]
timedStoreData
func
(
t
timedStoreDataSlice
)
Less
(
i
,
j
int
)
bool
{
return
t
[
i
]
.
timestamp
.
Before
(
t
[
j
]
.
timestamp
)
}
func
(
t
timedStoreDataSlice
)
Len
()
int
{
return
len
(
t
)
}
func
(
t
timedStoreDataSlice
)
Swap
(
i
,
j
int
)
{
t
[
i
],
t
[
j
]
=
t
[
j
],
t
[
i
]
}
// A time-based buffer for ContainerStats.
// Holds information for a specific time period and/or a max number of items.
type
TimedStore
struct
{
buffer
[]
timedStoreData
buffer
timedStoreDataSlice
age
time
.
Duration
maxItems
int
}
...
...
@@ -36,7 +50,7 @@ type timedStoreData struct {
// A maxItems value of -1 means no limit.
func
NewTimedStore
(
age
time
.
Duration
,
maxItems
int
)
*
TimedStore
{
return
&
TimedStore
{
buffer
:
make
(
[]
timedStoreData
,
0
),
buffer
:
make
(
timedStoreDataSlice
,
0
),
age
:
age
,
maxItems
:
maxItems
,
}
...
...
@@ -44,26 +58,29 @@ func NewTimedStore(age time.Duration, maxItems int) *TimedStore {
// Adds an element to the start of the buffer (removing one from the end if necessary).
func
(
self
*
TimedStore
)
Add
(
timestamp
time
.
Time
,
item
interface
{})
{
// Remove any elements before the eviction time.
evictTime
:=
timestamp
.
Add
(
-
self
.
age
)
index
:=
sort
.
Search
(
len
(
self
.
buffer
),
func
(
index
int
)
bool
{
return
self
.
buffer
[
index
]
.
timestamp
.
After
(
evictTime
)
})
if
index
<
len
(
self
.
buffer
)
{
self
.
buffer
=
self
.
buffer
[
index
:
]
}
// Remove any elements if over our max size.
if
self
.
maxItems
>=
0
&&
(
len
(
self
.
buffer
)
+
1
)
>
self
.
maxItems
{
startIndex
:=
len
(
self
.
buffer
)
+
1
-
self
.
maxItems
self
.
buffer
=
self
.
buffer
[
startIndex
:
]
}
// Add the new element first and sort. We can then remove an expired element, if required.
copied
:=
item
self
.
buffer
=
append
(
self
.
buffer
,
timedStoreData
{
timestamp
:
timestamp
,
data
:
copied
,
})
sort
.
Sort
(
self
.
buffer
)
// Remove any elements before eviction time.
// TODO(rjnagal): This is assuming that the added entry has timestamp close to now.
evictTime
:=
timestamp
.
Add
(
-
self
.
age
)
index
:=
sort
.
Search
(
len
(
self
.
buffer
),
func
(
index
int
)
bool
{
return
self
.
buffer
[
index
]
.
timestamp
.
After
(
evictTime
)
})
if
index
<
len
(
self
.
buffer
)
{
self
.
buffer
=
self
.
buffer
[
index
:
]
}
}
// Returns up to maxResult elements in the specified time period (inclusive).
...
...
@@ -80,9 +97,6 @@ func (self *TimedStore) InTimeRange(start, end time.Time, maxResults int) []inte
maxResults
=
-
1
}
// NOTE: Since we store the elments in descending timestamp order "start" will
// be a higher index than "end".
var
startIndex
int
if
start
.
IsZero
()
{
// None specified, start at the beginning.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment