|
84 | 84 | }, []string{"vpa_size_log2", "update_mode"},
|
85 | 85 | )
|
86 | 86 |
|
| 87 | + failedEvictionAttempts = prometheus.NewCounterVec( |
| 88 | + prometheus.CounterOpts{ |
| 89 | + Namespace: metricsNamespace, |
| 90 | + Name: "failed_eviction_attempts_total", |
| 91 | + Help: "Number of failed attempts to update Pods by eviction", |
| 92 | + }, []string{"vpa_size_log2", "update_mode", "reason"}, |
| 93 | + ) |
| 94 | + |
87 | 95 | inPlaceUpdatableCount = prometheus.NewGaugeVec(
|
88 | 96 | prometheus.GaugeOpts{
|
89 | 97 | Namespace: metricsNamespace,
|
@@ -130,7 +138,21 @@ var (
|
130 | 138 |
|
131 | 139 | // Register initializes all metrics for VPA Updater
|
132 | 140 | func Register() {
|
133 |
| - prometheus.MustRegister(controlledCount, evictableCount, evictedCount, vpasWithEvictablePodsCount, vpasWithEvictedPodsCount, inPlaceUpdatableCount, inPlaceUpdatedCount, vpasWithInPlaceUpdatablePodsCount, vpasWithInPlaceUpdatedPodsCount, failedInPlaceUpdateAttempts, functionLatency) |
| 141 | + collectors := []prometheus.Collector{ |
| 142 | + controlledCount, |
| 143 | + evictableCount, |
| 144 | + evictedCount, |
| 145 | + vpasWithEvictablePodsCount, |
| 146 | + vpasWithEvictedPodsCount, |
| 147 | + failedEvictionAttempts, |
| 148 | + inPlaceUpdatableCount, |
| 149 | + inPlaceUpdatedCount, |
| 150 | + vpasWithInPlaceUpdatablePodsCount, |
| 151 | + vpasWithInPlaceUpdatedPodsCount, |
| 152 | + failedInPlaceUpdateAttempts, |
| 153 | + functionLatency, |
| 154 | + } |
| 155 | + prometheus.MustRegister(collectors...) |
134 | 156 | }
|
135 | 157 |
|
136 | 158 | // NewExecutionTimer provides a timer for Updater's RunOnce execution
|
@@ -183,6 +205,12 @@ func AddEvictedPod(vpaSize int, mode vpa_types.UpdateMode) {
|
183 | 205 | evictedCount.WithLabelValues(strconv.Itoa(log2), string(mode)).Inc()
|
184 | 206 | }
|
185 | 207 |
|
| 208 | +// RecordFailedEviction increases the counter of failed eviction attempts by given VPA size, update mode and reason |
| 209 | +func RecordFailedEviction(vpaSize int, mode vpa_types.UpdateMode, reason string) { |
| 210 | + log2 := metrics.GetVpaSizeLog2(vpaSize) |
| 211 | + failedEvictionAttempts.WithLabelValues(strconv.Itoa(log2), string(mode), reason).Inc() |
| 212 | +} |
| 213 | + |
186 | 214 | // NewInPlaceUpdatablePodsCounter returns a wrapper for counting Pods which are matching in-place update criteria
|
187 | 215 | func NewInPlaceUpdatablePodsCounter() *SizeBasedGauge {
|
188 | 216 | return newSizeBasedGauge(inPlaceUpdatableCount)
|
|
0 commit comments