fix watch_cache_capacity metrics

This commit is contained in:
xiaofei.sun 2021-06-01 21:42:45 +08:00
parent e6136c0303
commit e3841e91c8

View File

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