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 committed Aug 30, 2023
1 parent 1521079 commit 6f20b28
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 6f20b28

Please sign in to comment.