@@ -76,13 +76,45 @@ var (
7676 }, []string {"vpa_size_log2" },
7777 )
7878
79+ inPlaceUpdatableCount = prometheus .NewGaugeVec (
80+ prometheus.GaugeOpts {
81+ Namespace : metricsNamespace ,
82+ Name : "in_place_Updatable_pods_total" ,
83+ Help : "Number of Pods matching in place update criteria." ,
84+ }, []string {"vpa_size_log2" },
85+ )
86+
87+ inPlaceUpdatedCount = prometheus .NewCounterVec (
88+ prometheus.CounterOpts {
89+ Namespace : metricsNamespace ,
90+ Name : "in_place_updated_pods_total" ,
91+ Help : "Number of Pods updated in-place by Updater to apply a new recommendation." ,
92+ }, []string {"vpa_size_log2" },
93+ )
94+
95+ vpasWithInPlaceUpdatablePodsCount = prometheus .NewGaugeVec (
96+ prometheus.GaugeOpts {
97+ Namespace : metricsNamespace ,
98+ Name : "vpas_with_in_place_Updatable_pods_total" ,
99+ Help : "Number of VPA objects with at least one Pod matching in place update criteria." ,
100+ }, []string {"vpa_size_log2" },
101+ )
102+
103+ vpasWithInPlaceUpdatedPodsCount = prometheus .NewGaugeVec (
104+ prometheus.GaugeOpts {
105+ Namespace : metricsNamespace ,
106+ Name : "vpas_with_in_place_updated_pods_total" ,
107+ Help : "Number of VPA objects with at least one in-place updated Pod." ,
108+ }, []string {"vpa_size_log2" },
109+ )
110+
79111 functionLatency = metrics .CreateExecutionTimeMetric (metricsNamespace ,
80112 "Time spent in various parts of VPA Updater main loop." )
81113)
82114
83115// Register initializes all metrics for VPA Updater
84116func Register () {
85- prometheus .MustRegister (controlledCount , evictableCount , evictedCount , vpasWithEvictablePodsCount , vpasWithEvictedPodsCount , functionLatency )
117+ prometheus .MustRegister (controlledCount , evictableCount , evictedCount , vpasWithEvictablePodsCount , vpasWithEvictedPodsCount , inPlaceUpdatableCount , inPlaceUpdatedCount , vpasWithInPlaceUpdatablePodsCount , vpasWithInPlaceUpdatedPodsCount , functionLatency )
86118}
87119
88120// NewExecutionTimer provides a timer for Updater's RunOnce execution
@@ -124,6 +156,27 @@ func AddEvictedPod(vpaSize int) {
124156 evictedCount .WithLabelValues (strconv .Itoa (log2 )).Inc ()
125157}
126158
159+ // NewInPlaceUpdtateablePodsCounter returns a wrapper for counting Pods which are matching in-place update criteria
160+ func NewInPlaceUpdtateablePodsCounter () * SizeBasedGauge {
161+ return newSizeBasedGauge (evictableCount )
162+ }
163+
164+ // NewVpasWithInPlaceUpdtateablePodsCounter returns a wrapper for counting VPA objects with Pods matching in-place update criteria
165+ func NewVpasWithInPlaceUpdtateablePodsCounter () * SizeBasedGauge {
166+ return newSizeBasedGauge (vpasWithEvictablePodsCount )
167+ }
168+
169+ // NewVpasWithInPlaceUpdtatedPodsCounter returns a wrapper for counting VPA objects with evicted Pods
170+ func NewVpasWithInPlaceUpdtatedPodsCounter () * SizeBasedGauge {
171+ return newSizeBasedGauge (vpasWithEvictedPodsCount )
172+ }
173+
174+ // AddInPlaceUpdatedPod increases the counter of pods updated in place by Updater, by given VPA size
175+ func AddInPlaceUpdatedPod (vpaSize int ) {
176+ log2 := metrics .GetVpaSizeLog2 (vpaSize )
177+ inPlaceUpdatedCount .WithLabelValues (strconv .Itoa (log2 )).Inc ()
178+ }
179+
127180// Add increases the counter for the given VPA size
128181func (g * SizeBasedGauge ) Add (vpaSize int , value int ) {
129182 log2 := metrics .GetVpaSizeLog2 (vpaSize )
0 commit comments