Bump cgroups pkg to e950a27f3faf567abbf995bfbec90
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
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")
|
||||
)
|
||||
|
||||
// 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
|
||||
// that cgroups can be added for collection
|
||||
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 {
|
||||
id string
|
||||
c cgroups.Cgroup
|
||||
id string
|
||||
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()
|
||||
defer o.mu.Unlock()
|
||||
fd, err := cg.OOMEventFD()
|
||||
@@ -45,8 +46,9 @@ func (o *OOMCollector) Add(id string, cg cgroups.Cgroup) error {
|
||||
return err
|
||||
}
|
||||
o.set[fd] = &oom{
|
||||
id: id,
|
||||
c: cg,
|
||||
id: id,
|
||||
c: cg,
|
||||
triggers: triggers,
|
||||
}
|
||||
// set the gauge's default value
|
||||
o.memoryOOM.WithValues(id).Set(0)
|
||||
@@ -102,6 +104,9 @@ func (o *OOMCollector) process(fd uintptr, event uint32) {
|
||||
return
|
||||
}
|
||||
o.memoryOOM.WithValues(info.id).Inc(1)
|
||||
for _, t := range info.triggers {
|
||||
t(info.id, info.c)
|
||||
}
|
||||
}
|
||||
|
||||
func flush(fd uintptr) error {
|
||||
|
||||
Reference in New Issue
Block a user