diff --git a/components/ws-manager/pkg/manager/monitor.go b/components/ws-manager/pkg/manager/monitor.go index 163e447a00530f..5361222ec4c3b0 100644 --- a/components/ws-manager/pkg/manager/monitor.go +++ b/components/ws-manager/pkg/manager/monitor.go @@ -800,22 +800,28 @@ func (m *Monitor) initializeWorkspaceContent(ctx context.Context, pod *corev1.Po hist.Observe(time.Since(t).Seconds()) } + _, isBackup := initializer.Spec.(*csapi.WorkspaceInitializer_Backup) + if err != nil { - c, cErr := m.manager.metrics.totalRestoreFailureCounterVec.GetMetricWithLabelValues(wsType, wsClass) - if cErr != nil { - log.WithError(cErr).WithField("type", wsType).Warn("cannot get counter for workspace restore failure counter") - } else { - c.Inc() + if isBackup { + c, cErr := m.manager.metrics.totalRestoreFailureCounterVec.GetMetricWithLabelValues(wsType, wsClass) + if cErr != nil { + log.WithError(cErr).WithField("type", wsType).Warn("cannot get counter for workspace restore failure counter") + } else { + c.Inc() + } } return xerrors.Errorf("cannot initialize workspace: %w", err) } - c, cErr := m.manager.metrics.totalRestoreSuccessCounterVec.GetMetricWithLabelValues(wsType, wsClass) - if cErr != nil { - log.WithError(cErr).WithField("type", wsType).Warn("cannot get counter for workspace restore success counter") - } else { - c.Inc() + if isBackup { + c, cErr := m.manager.metrics.totalRestoreSuccessCounterVec.GetMetricWithLabelValues(wsType, wsClass) + if cErr != nil { + log.WithError(cErr).WithField("type", wsType).Warn("cannot get counter for workspace restore success counter") + } else { + c.Inc() + } } return nil }