mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
improve watchCache metrics
This commit is contained in:
parent
865cbf0bdf
commit
58e4fae1da
@ -56,12 +56,22 @@ var (
|
||||
},
|
||||
[]string{"resource"},
|
||||
)
|
||||
|
||||
watchCacheCapacity = metrics.NewGaugeVec(
|
||||
&metrics.GaugeOpts{
|
||||
Name: "watch_cache_capacity",
|
||||
Help: "Total capacity of watch cache broken by resource type.",
|
||||
StabilityLevel: metrics.ALPHA,
|
||||
},
|
||||
[]string{"resource"},
|
||||
)
|
||||
)
|
||||
|
||||
func init() {
|
||||
legacyregistry.MustRegister(initCounter)
|
||||
legacyregistry.MustRegister(watchCacheCapacityIncreaseTotal)
|
||||
legacyregistry.MustRegister(watchCacheCapacityDecreaseTotal)
|
||||
legacyregistry.MustRegister(watchCacheCapacity)
|
||||
}
|
||||
|
||||
// recordsWatchCacheCapacityChange record watchCache capacity resize(increase or decrease) operations.
|
||||
@ -71,4 +81,5 @@ func recordsWatchCacheCapacityChange(objType string, old, new int) {
|
||||
return
|
||||
}
|
||||
watchCacheCapacityDecreaseTotal.WithLabelValues(objType).Inc()
|
||||
watchCacheCapacity.WithLabelValues(objType).Set(float64(new))
|
||||
}
|
||||
|
@ -216,6 +216,8 @@ func newWatchCache(
|
||||
versioner: versioner,
|
||||
objectType: objectType,
|
||||
}
|
||||
objType := objectType.String()
|
||||
watchCacheCapacity.WithLabelValues(objType).Set(float64(wc.capacity))
|
||||
wc.cond = sync.NewCond(wc.RLocker())
|
||||
return wc
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user