Merge pull request #102484 from xiaoanyunfei/fix/watch_cache_metrics

fix watch_cache_capacity  metrics
This commit is contained in:
Kubernetes Prow Robot 2021-06-02 06:24:18 -07:00 committed by GitHub
commit a79a0f546a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,10 +86,10 @@ func init() {
// recordsWatchCacheCapacityChange record watchCache capacity resize(increase or decrease) operations. // recordsWatchCacheCapacityChange record watchCache capacity resize(increase or decrease) operations.
func recordsWatchCacheCapacityChange(objType string, old, new int) { func recordsWatchCacheCapacityChange(objType string, old, new int) {
watchCacheCapacity.WithLabelValues(objType).Set(float64(new))
if old < new { if old < new {
watchCacheCapacityIncreaseTotal.WithLabelValues(objType).Inc() watchCacheCapacityIncreaseTotal.WithLabelValues(objType).Inc()
return return
} }
watchCacheCapacityDecreaseTotal.WithLabelValues(objType).Inc() watchCacheCapacityDecreaseTotal.WithLabelValues(objType).Inc()
watchCacheCapacity.WithLabelValues(objType).Set(float64(new))
} }