Skip to content

Commit d3795ea

Browse files
committed
feat: Add function to reset label allow list for apiserver endpoints metrics
1 parent d34c181 commit d3795ea

File tree

1 file changed

+27
-0
lines changed
  • staging/src/k8s.io/apiserver/pkg/endpoints/metrics

1 file changed

+27
-0
lines changed

staging/src/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,33 @@ func Reset() {
416416
}
417417
}
418418

419+
// ResetLabelAllowLists resets the label allow lists for all metrics.
420+
// NOTE: This is only used for testing.
421+
func ResetLabelAllowLists() {
422+
for _, metric := range metrics {
423+
if counterVec, ok := metric.(*compbasemetrics.CounterVec); ok {
424+
counterVec.ResetLabelAllowLists()
425+
continue
426+
}
427+
if gaugeVec, ok := metric.(*compbasemetrics.GaugeVec); ok {
428+
gaugeVec.ResetLabelAllowLists()
429+
continue
430+
}
431+
if histogramVec, ok := metric.(*compbasemetrics.HistogramVec); ok {
432+
histogramVec.ResetLabelAllowLists()
433+
continue
434+
}
435+
if summaryVec, ok := metric.(*compbasemetrics.SummaryVec); ok {
436+
summaryVec.ResetLabelAllowLists()
437+
continue
438+
}
439+
if timingHistogramVec, ok := metric.(*compbasemetrics.TimingHistogramVec); ok {
440+
timingHistogramVec.ResetLabelAllowLists()
441+
continue
442+
}
443+
}
444+
}
445+
419446
// UpdateInflightRequestMetrics reports concurrency metrics classified by
420447
// mutating vs Readonly.
421448
func UpdateInflightRequestMetrics(phase string, nonmutating, mutating int) {

0 commit comments

Comments
 (0)