Skip to content

Commit

Permalink
metrics:set metrics if not nil
Browse files Browse the repository at this point in the history
Signed-off-by: rakeshgm <[email protected]>
  • Loading branch information
rakeshgm authored and BenamarMk committed Oct 4, 2023
1 parent 1521079 commit 1ff72a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions controllers/drplacementcontrol_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,9 @@ func (r *DRPlacementControlReconciler) updateResourceCondition(
drpc.Status.ResourceConditions = rmn.VRGConditions{}
drpc.Status.LastGroupSyncTime = nil

r.setLastSyncTimeMetric(syncmetric, nil, log)
if syncmetric != nil {
r.setLastSyncTimeMetric(syncmetric, nil, log)
}
} else {
drpc.Status.ResourceConditions.ResourceMeta.Kind = vrg.Kind
drpc.Status.ResourceConditions.ResourceMeta.Name = vrg.Name
Expand All @@ -1522,7 +1524,9 @@ func (r *DRPlacementControlReconciler) updateResourceCondition(
drpc.Status.ResourceConditions.ResourceMeta.ProtectedPVCs = protectedPVCs
drpc.Status.LastGroupSyncTime = vrg.Status.LastGroupSyncTime

r.setLastSyncTimeMetric(syncmetric, vrg.Status.LastGroupSyncTime, log)
if syncmetric != nil {
r.setLastSyncTimeMetric(syncmetric, vrg.Status.LastGroupSyncTime, log)
}
}
}

Expand Down

0 comments on commit 1ff72a8

Please sign in to comment.