From b30ff8e4e7a7715eaf8e01241688b573d42f3782 Mon Sep 17 00:00:00 2001 From: Kyle Brennan Date: Wed, 20 Sep 2023 18:32:50 +0000 Subject: [PATCH] Fix --- .../ws-manager-mk2/controllers/workspace_controller.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/ws-manager-mk2/controllers/workspace_controller.go b/components/ws-manager-mk2/controllers/workspace_controller.go index 663d2c25ed6286..5d11741eb1c3ef 100644 --- a/components/ws-manager-mk2/controllers/workspace_controller.go +++ b/components/ws-manager-mk2/controllers/workspace_controller.go @@ -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 { @@ -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) {