Skip to content

Commit

Permalink
Observe metrics when there are no errors.
Browse files Browse the repository at this point in the history
Signed-off-by: JenTing Hsiao <[email protected]>
  • Loading branch information
jenting committed May 30, 2022
1 parent e10c7bd commit 6770d3c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/ws-manager/pkg/manager/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,9 @@ func (m *Monitor) initializeWorkspaceContent(ctx context.Context, pod *corev1.Po
hist, errHist := m.manager.metrics.initializeTimeHistVec.GetMetricWithLabelValues(wsType)
if errHist != nil {
log.WithError(errHist).WithField("type", wsType).Warn("cannot get initialize time histogram metric")
} else {
hist.Observe(time.Since(t).Seconds())
}
hist.Observe(time.Since(t).Seconds())
if err != nil {
return xerrors.Errorf("cannot initialize workspace: %w", err)
}
Expand Down Expand Up @@ -1023,8 +1024,9 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
hist, err := m.manager.metrics.volumeSnapshotTimeHistVec.GetMetricWithLabelValues(wsType)
if err != nil {
log.WithError(err).WithField("type", wsType).Warn("cannot get volume snapshot time histogram metric")
} else {
hist.Observe(time.Since(volumeSnapshotTime).Seconds())
}
hist.Observe(time.Since(volumeSnapshotTime).Seconds())
}
if readyVolumeSnapshot && !markVolumeSnapshotAnnotation {
log = log.WithField("VolumeSnapshotContent.Name", pvcVolumeSnapshotContentName)
Expand Down Expand Up @@ -1167,8 +1169,9 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
hist, err := m.manager.metrics.finalizeTimeHistVec.GetMetricWithLabelValues(wsType)
if err != nil {
log.WithError(err).WithField("type", wsType).Warn("cannot get finalize time histogram metric")
} else {
hist.Observe(time.Since(t).Seconds())
}
hist.Observe(time.Since(t).Seconds())

disposalStatus = &workspaceDisposalStatus{
BackupComplete: true,
Expand Down

0 comments on commit 6770d3c

Please sign in to comment.