Bump cgroups pkg to e950a27f3faf567abbf995bfbec90
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
d41f146eed
commit
e745efdddb
@ -1,6 +1,6 @@
|
|||||||
github.com/crosbymichael/go-runc 65847bfc51952703ca24b564d10de50d3f2db6e7
|
github.com/crosbymichael/go-runc 65847bfc51952703ca24b564d10de50d3f2db6e7
|
||||||
github.com/crosbymichael/console f13f890e20a94bdec6c328cdf9410b7158f0cfa4
|
github.com/crosbymichael/console f13f890e20a94bdec6c328cdf9410b7158f0cfa4
|
||||||
github.com/crosbymichael/cgroups a692a19766b072b86d89620c97a7916b2e2de3e7
|
github.com/crosbymichael/cgroups e950a27f3faf567abbf995bfbec90eaddc766d25
|
||||||
github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87
|
github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87
|
||||||
github.com/prometheus/client_golang v0.8.0
|
github.com/prometheus/client_golang v0.8.0
|
||||||
github.com/prometheus/client_model fa8ad6fec33561be4280a8f0514318c79d7f6cb6
|
github.com/prometheus/client_model fa8ad6fec33561be4280a8f0514318c79d7f6cb6
|
||||||
|
4
vendor/github.com/crosbymichael/cgroups/prometheus/metrics.go
generated
vendored
4
vendor/github.com/crosbymichael/cgroups/prometheus/metrics.go
generated
vendored
@ -16,6 +16,10 @@ var (
|
|||||||
ErrCgroupNotExists = errors.New("cgroup does not exist in the collector")
|
ErrCgroupNotExists = errors.New("cgroup does not exist in the collector")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Trigger will be called when an event happens and provides the cgroup
|
||||||
|
// where the event originated from
|
||||||
|
type Trigger func(string, cgroups.Cgroup)
|
||||||
|
|
||||||
// New registers the Collector with the provided namespace and returns it so
|
// New registers the Collector with the provided namespace and returns it so
|
||||||
// that cgroups can be added for collection
|
// that cgroups can be added for collection
|
||||||
func New(ns *metrics.Namespace) *Collector {
|
func New(ns *metrics.Namespace) *Collector {
|
||||||
|
15
vendor/github.com/crosbymichael/cgroups/prometheus/oom.go
generated
vendored
15
vendor/github.com/crosbymichael/cgroups/prometheus/oom.go
generated
vendored
@ -33,11 +33,12 @@ type OOMCollector struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type oom struct {
|
type oom struct {
|
||||||
id string
|
id string
|
||||||
c cgroups.Cgroup
|
c cgroups.Cgroup
|
||||||
|
triggers []Trigger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OOMCollector) Add(id string, cg cgroups.Cgroup) error {
|
func (o *OOMCollector) Add(id string, cg cgroups.Cgroup, triggers ...Trigger) error {
|
||||||
o.mu.Lock()
|
o.mu.Lock()
|
||||||
defer o.mu.Unlock()
|
defer o.mu.Unlock()
|
||||||
fd, err := cg.OOMEventFD()
|
fd, err := cg.OOMEventFD()
|
||||||
@ -45,8 +46,9 @@ func (o *OOMCollector) Add(id string, cg cgroups.Cgroup) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
o.set[fd] = &oom{
|
o.set[fd] = &oom{
|
||||||
id: id,
|
id: id,
|
||||||
c: cg,
|
c: cg,
|
||||||
|
triggers: triggers,
|
||||||
}
|
}
|
||||||
// set the gauge's default value
|
// set the gauge's default value
|
||||||
o.memoryOOM.WithValues(id).Set(0)
|
o.memoryOOM.WithValues(id).Set(0)
|
||||||
@ -102,6 +104,9 @@ func (o *OOMCollector) process(fd uintptr, event uint32) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
o.memoryOOM.WithValues(info.id).Inc(1)
|
o.memoryOOM.WithValues(info.id).Inc(1)
|
||||||
|
for _, t := range info.triggers {
|
||||||
|
t(info.id, info.c)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func flush(fd uintptr) error {
|
func flush(fd uintptr) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user