Skip to content

Commit

Permalink
cleanup metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
modulitos committed Nov 14, 2024
1 parent 34280cc commit ed8a585
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions pkg/cache/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,8 @@ import (
"sync"

"k8s.io/klog/v2"

"github.com/prometheus/client_golang/prometheus"
)

var notificationUsage = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "pod_identity_cache_notifications",
Help: "Counter of SA notifications",
},
[]string{"method"},
)

func init() {
prometheus.MustRegister(notificationUsage)
}

type notifications struct {
handlers map[string]chan struct{}
mu sync.Mutex
Expand All @@ -37,12 +23,10 @@ func (n *notifications) create(req Request) <-chan struct{} {
n.mu.Lock()
defer n.mu.Unlock()

notificationUsage.WithLabelValues("used").Inc()
notifier, found := n.handlers[req.CacheKey()]
if !found {
notifier = make(chan struct{})
n.handlers[req.CacheKey()] = notifier
notificationUsage.WithLabelValues("created").Inc()
n.fetchRequests <- &req
}
return notifier
Expand All @@ -53,7 +37,6 @@ func (n *notifications) broadcast(key string) {
defer n.mu.Unlock()
if handler, found := n.handlers[key]; found {
klog.V(5).Infof("Notifying handlers for %q", key)
notificationUsage.WithLabelValues("broadcast").Inc()
close(handler)
delete(n.handlers, key)
}
Expand Down

0 comments on commit ed8a585

Please sign in to comment.