@@ -795,8 +795,9 @@ func (m *Monitor) initializeWorkspaceContent(ctx context.Context, pod *corev1.Po
795
795
hist , errHist := m .manager .metrics .initializeTimeHistVec .GetMetricWithLabelValues (wsType )
796
796
if errHist != nil {
797
797
log .WithError (errHist ).WithField ("type" , wsType ).Warn ("cannot get initialize time histogram metric" )
798
+ } else {
799
+ hist .Observe (time .Since (t ).Seconds ())
798
800
}
799
- hist .Observe (time .Since (t ).Seconds ())
800
801
if err != nil {
801
802
return xerrors .Errorf ("cannot initialize workspace: %w" , err )
802
803
}
@@ -1023,8 +1024,9 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
1023
1024
hist , err := m .manager .metrics .volumeSnapshotTimeHistVec .GetMetricWithLabelValues (wsType )
1024
1025
if err != nil {
1025
1026
log .WithError (err ).WithField ("type" , wsType ).Warn ("cannot get volume snapshot time histogram metric" )
1027
+ } else {
1028
+ hist .Observe (time .Since (volumeSnapshotTime ).Seconds ())
1026
1029
}
1027
- hist .Observe (time .Since (volumeSnapshotTime ).Seconds ())
1028
1030
}
1029
1031
if readyVolumeSnapshot && ! markVolumeSnapshotAnnotation {
1030
1032
log = log .WithField ("VolumeSnapshotContent.Name" , pvcVolumeSnapshotContentName )
@@ -1167,8 +1169,9 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
1167
1169
hist , err := m .manager .metrics .finalizeTimeHistVec .GetMetricWithLabelValues (wsType )
1168
1170
if err != nil {
1169
1171
log .WithError (err ).WithField ("type" , wsType ).Warn ("cannot get finalize time histogram metric" )
1172
+ } else {
1173
+ hist .Observe (time .Since (t ).Seconds ())
1170
1174
}
1171
- hist .Observe (time .Since (t ).Seconds ())
1172
1175
1173
1176
disposalStatus = & workspaceDisposalStatus {
1174
1177
BackupComplete : true ,
0 commit comments