Skip to content

Commit d1b517d

Browse files
authored
Merge pull request #341 from linki/pod-deleted-metric
Add namespace metadata to deleted pods metric
2 parents e6f421d + 0dacb85 commit d1b517d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

chaoskube/chaoskube.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func (c *Chaoskube) DeletePod(ctx context.Context, victim v1.Pod) error {
261261
return err
262262
}
263263

264-
metrics.PodsDeletedTotal.Inc()
264+
metrics.PodsDeletedTotal.WithLabelValues(victim.Namespace).Inc()
265265

266266
ref, err := reference.GetReference(scheme.Scheme, &victim)
267267
if err != nil {

metrics/metrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77

88
var (
99
// PodsDeletedTotal is the total number of deleted pods.
10-
PodsDeletedTotal = promauto.NewCounter(prometheus.CounterOpts{
10+
PodsDeletedTotal = promauto.NewCounterVec(prometheus.CounterOpts{
1111
Namespace: "chaoskube",
1212
Name: "pods_deleted_total",
1313
Help: "The total number of pods deleted",
14-
})
14+
}, []string{"namespace"})
1515
// IntervalsTotal is the total number of intervals, i.e. call to Run().
1616
IntervalsTotal = promauto.NewCounter(prometheus.CounterOpts{
1717
Namespace: "chaoskube",

0 commit comments

Comments
 (0)