fix: added count checks (#2083)

This commit is contained in:
Jan-Otto Kröpke
2025-06-19 16:59:19 +02:00
committed by GitHub
parent f285c3d1e2
commit 4891e23d29
7 changed files with 15 additions and 1 deletions

View File

@@ -290,6 +290,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(