diff --git a/plugins/ptp_operator/event/event.go b/plugins/ptp_operator/event/event.go index 2199761a..e75b3319 100644 --- a/plugins/ptp_operator/event/event.go +++ b/plugins/ptp_operator/event/event.go @@ -194,7 +194,9 @@ func (p *PTPEventState) DeleteAllMetrics() { if d.Metric != nil { // unregister metric for _, v := range d.Metric { - v.metricGauge.Delete(prometheus.Labels{"process": d.Process, "iface": *d.IFace, "node": d.NodeName}) + if v.metricGauge != nil && d.IFace != nil { + v.metricGauge.Delete(prometheus.Labels{"process": d.Process, "iface": *d.IFace, "node": d.NodeName}) + } } } delete(p.DependsOn, d.Process)