Merge pull request #133817 from serathius/stats-logs

Disable collecting stats for resources not setting prefix to prevent error logs

Kubernetes-commit: 947a8ebfd14fe14b25222a50be28accae80fbd2c
This commit is contained in:
Kubernetes Publisher 2025-09-02 09:31:16 -07:00
commit a68e6c2997
1 changed files with 2 additions and 1 deletions

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