Skip to content

Commit

Permalink
add namespace metadata to deleted pods metric
Browse files Browse the repository at this point in the history
  • Loading branch information
linki committed May 18, 2021
1 parent 2fe55d4 commit 0dacb85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion chaoskube/chaoskube.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 0dacb85

Please sign in to comment.