Skip to content

Commit

Permalink
Merge pull request #341 from linki/pod-deleted-metric
Browse files Browse the repository at this point in the history
Add namespace metadata to deleted pods metric
  • Loading branch information
linki authored Jun 7, 2021
2 parents e6f421d + 0dacb85 commit d1b517d
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 d1b517d

Please sign in to comment.