Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kylos101 committed Sep 20, 2023
1 parent 14849d6 commit b30ff8e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ func (r *WorkspaceReconciler) logImagePullDuration(ctx context.Context, pod *cor
err := r.Client.List(ctx, eventList, eventListOpts)
if err != nil {
log.Error(err, "cannot list events for workspace pod", "pod", pod.Name)
return
}
var pullStartTime, pullEndTime time.Time
for _, event := range eventList.Items {
Expand All @@ -333,11 +334,13 @@ func (r *WorkspaceReconciler) logImagePullDuration(ctx context.Context, pod *cor

if pullStartTime.IsZero() || pullEndTime.IsZero() {
msg := fmt.Sprintf("cannot determine pull time for: %s", pod.Name)
log.Info("cannot get image pull duration", "warning", msg, "startZero", pullStartTime.IsZero(), "endZero", pullEndTime.IsZero())
log.Info("insufficient data to measure image pull duration", "warning", msg, "startZero", pullStartTime.IsZero(), "endZero", pullEndTime.IsZero())
return
}

duration := pullEndTime.Sub(pullStartTime)
log.Info("image pull duration", "duration", duration.String())
// TODO: emit metric
}

func (r *WorkspaceReconciler) updateMetrics(ctx context.Context, workspace *workspacev1.Workspace) {
Expand Down

0 comments on commit b30ff8e

Please sign in to comment.