Skip to content

Commit 4055185

Browse files
authored
Merge pull request #2727 from mikebrow/ignore-idempotence
allow idempotence when adding a task to cgroup metrics collection
2 parents 9c1db67 + 879b2ae commit 4055185

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

metrics/cgroups/metrics.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package cgroups
2020

2121
import (
2222
"context"
23-
"errors"
2423
"fmt"
2524
"sync"
2625

@@ -33,13 +32,6 @@ import (
3332
"github.com/prometheus/client_golang/prometheus"
3433
)
3534

36-
var (
37-
// ErrAlreadyCollected is returned when a cgroups is already being monitored
38-
ErrAlreadyCollected = errors.New("cgroup is already being collected")
39-
// ErrCgroupNotExists is returns when a cgroup no longer exists
40-
ErrCgroupNotExists = errors.New("cgroup does not exist in the collector")
41-
)
42-
4335
// Trigger will be called when an event happens and provides the cgroup
4436
// where the event originated from
4537
type Trigger func(string, string, cgroups.Cgroup)
@@ -141,7 +133,7 @@ func (c *collector) Add(t runtime.Task) error {
141133
defer c.mu.Unlock()
142134
id := taskID(t.ID(), t.Namespace())
143135
if _, ok := c.tasks[id]; ok {
144-
return ErrAlreadyCollected
136+
return nil // requests to collect metrics should be idempotent
145137
}
146138
c.tasks[id] = t
147139
return nil

0 commit comments

Comments
 (0)