[0.30] fix: added count checks (#2083) (#2089)

This commit is contained in:
Jan-Otto Kröpke
2025-06-21 11:28:30 +02:00
committed by GitHub
parent a3131dc087
commit 3d7b16d61d
7 changed files with 15 additions and 1 deletions

View File

@@ -288,6 +288,8 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
err := c.perfDataCollector.Collect(&c.perfDataObject)
if err != nil {
return fmt.Errorf("failed to collect Cache metrics: %w", err)
} else if len(c.perfDataObject) == 0 {
return fmt.Errorf("failed to collect Cache metrics: %w", types.ErrNoDataUnexpected)
}
ch <- prometheus.MustNewConstMetric(