Add a warning message if metric not found

Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
This commit is contained in:
Xiaodong Ye 2024-11-20 08:48:47 +08:00
parent 5346a18a04
commit 699af30017

View file

@ -230,6 +230,11 @@ func (c *rdmaCollector) Update(ch chan<- prometheus.Metric) error {
if !c.metricsPattern.MatchString(name) {
return
}
entry := c.entry(name)
if entry == nil {
c.logger.Warn("rdma metric not found", "name", name)
return
}
ch <- prometheus.MustNewConstMetric(c.entry(name), prometheus.GaugeValue,
value, labelValues...)
}