Merge pull request #133817 from serathius/stats-logs

Disable collecting stats for resources not setting prefix to prevent error logs
This commit is contained in:
Kubernetes Prow Robot
2025-09-02 09:31:16 -07:00
committed by GitHub

View File

@@ -186,7 +186,8 @@ func New(c *kubernetes.Client, compactor Compactor, codec runtime.Codec, newFunc
newListFunc: newListFunc,
compactor: compactor,
}
if utilfeature.DefaultFeatureGate.Enabled(features.SizeBasedListCostEstimate) {
// Collecting stats requires properly set resourcePrefix to call getKeys.
if resourcePrefix != "" && utilfeature.DefaultFeatureGate.Enabled(features.SizeBasedListCostEstimate) {
stats := newStatsCache(pathPrefix, s.getKeys)
s.stats = stats
w.stats = stats