diff --git a/chaoskube/chaoskube.go b/chaoskube/chaoskube.go index ec3dfe76..1bb7a7ba 100644 --- a/chaoskube/chaoskube.go +++ b/chaoskube/chaoskube.go @@ -261,7 +261,7 @@ func (c *Chaoskube) DeletePod(ctx context.Context, victim v1.Pod) error { return err } - metrics.PodsDeletedTotal.Inc() + metrics.PodsDeletedTotal.WithLabelValues(victim.Namespace).Inc() ref, err := reference.GetReference(scheme.Scheme, &victim) if err != nil { diff --git a/metrics/metrics.go b/metrics/metrics.go index 052243a5..a38c2f76 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -7,11 +7,11 @@ import ( var ( // PodsDeletedTotal is the total number of deleted pods. - PodsDeletedTotal = promauto.NewCounter(prometheus.CounterOpts{ + PodsDeletedTotal = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: "chaoskube", Name: "pods_deleted_total", Help: "The total number of pods deleted", - }) + }, []string{"namespace"}) // IntervalsTotal is the total number of intervals, i.e. call to Run(). IntervalsTotal = promauto.NewCounter(prometheus.CounterOpts{ Namespace: "chaoskube",