-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ws-manager] add metrics to track initialize and finalize of workspaces #9355
Conversation
@@ -916,6 +922,7 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb | |||
backupError error | |||
gitStatus *csapi.GitStatus | |||
) | |||
t := time.Now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better that calculate the start time at finalizeWorkspaceContent and have a defer function to calculate the end time? For example:
func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceObjects) {
t := time.Now()
...
tpe, err := wso.WorkspaceType()
if err != nil {
tracing.LogError(span, err)
log.WithError(err).Warn("cannot determine workspace type - assuming this is a regular")
tpe = api.WorkspaceType_REGULAR
}
defer func() {
wsType := api.WorkspaceType_name[int32(tpe)]
hist, errHist := m.manager.metrics.finalizeTimeHistVec.GetMetricWithLabelValues(wsType)
if errHist != nil {
log.WithError(errHist).WithField("type", wsType).Warn("cannot get finalize time histogram metric")
}
hist.Observe(time.Since(t).Seconds())
}()
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought of that, but that would catch incorrect metrics in case of this return
statement:
gitpod/components/ws-manager/pkg/manager/monitor.go
Lines 929 to 933 in 054bd0b
if !didSometing { | |
// someone else is managing finalization process ... we don't have to bother | |
return | |
} | |
I only want to catch timing for workspaces where we actually did some work.
Description
Add metrics to track initialize (time it takes to download and untar backup for example or to load prebuild) and finalize (time it takes to create and upload backup of workspace).
This metrics will be used later on to compare them to PVC implementation.
Related Issue(s)
Fixes #9353
How to test
Spin up new workspace preview environment using installer from this PR
Create new workspace, create large file in workspace and stop workspace.
Then open that workspace again.
Port forward metrics port of ws-manager and look for new metrics.
Times reported will match the time it took to finalize or initialize the workspace.
Release Notes
Documentation