@@ -880,6 +880,7 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
880
880
log .WithError (err ).Warn ("cannot determine workspace type - assuming this is a regular" )
881
881
tpe = api .WorkspaceType_REGULAR
882
882
}
883
+ wsType := api .WorkspaceType_name [int32 (tpe )]
883
884
884
885
var (
885
886
createdVolumeSnapshot bool
@@ -891,6 +892,8 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
891
892
pvcVolumeSnapshotName string = workspaceID
892
893
pvcVolumeSnapshotContentName string
893
894
pvcVolumeSnapshotClassName string
895
+
896
+ volumeSnapshotTime time.Time
894
897
)
895
898
if wso .Pod != nil {
896
899
_ , pvcFeatureEnabled = wso .Pod .Labels [pvcWorkspaceFeatureAnnotation ]
@@ -973,6 +976,7 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
973
976
return true , nil , err
974
977
}
975
978
createdVolumeSnapshot = true
979
+ volumeSnapshotTime = time .Now ()
976
980
}
977
981
if createdVolumeSnapshot {
978
982
backoff := wait.Backoff {
@@ -1016,6 +1020,11 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
1016
1020
return true , nil , err
1017
1021
}
1018
1022
readyVolumeSnapshot = true
1023
+ hist , err := m .manager .metrics .volumeSnapshotTimeHistVec .GetMetricWithLabelValues (wsType )
1024
+ if err != nil {
1025
+ log .WithError (err ).WithField ("type" , wsType ).Warn ("cannot get volume snapshot time histogram metric" )
1026
+ }
1027
+ hist .Observe (time .Since (volumeSnapshotTime ).Seconds ())
1019
1028
}
1020
1029
if readyVolumeSnapshot && ! markVolumeSnapshotAnnotation {
1021
1030
log = log .WithField ("VolumeSnapshotContent.Name" , pvcVolumeSnapshotContentName )
@@ -1154,7 +1163,7 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
1154
1163
}
1155
1164
break
1156
1165
}
1157
- wsType := api . WorkspaceType_name [ int32 ( tpe )]
1166
+
1158
1167
hist , err := m .manager .metrics .finalizeTimeHistVec .GetMetricWithLabelValues (wsType )
1159
1168
if err != nil {
1160
1169
log .WithError (err ).WithField ("type" , wsType ).Warn ("cannot get finalize time histogram metric" )
0 commit comments