Skip to content

[dashboard/code] Produce timing data for workspace startup #4907

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

Merged
merged 2 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions components/dashboard/src/start/StartWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ export default class StartWorkspace extends React.Component<StartWorkspaceProps,
this.toDispose.dispose();
}

componentDidUpdate(prevPros: StartWorkspaceProps, prevState: StartWorkspaceState) {
const newPhase = this.state?.workspaceInstance?.status.phase;
const oldPhase = prevState.workspaceInstance?.status.phase;
if (newPhase !== oldPhase) {
getGitpodService().server.trackEvent({
event: "status_rendered",
properties: { workspaceId: this.state?.workspaceInstance?.workspaceId, "phase": newPhase },
});
}

if (!!this.state.error && this.state.error !== prevState.error) {
getGitpodService().server.trackEvent({
event: "error_rendered",
properties: { workspaceId: this.state?.workspaceInstance?.workspaceId, "error": this.state.error },
});
}
}

async startWorkspace(restart = false, forceDefaultImage = false) {
const state = this.state;
if (state) {
Expand Down
1 change: 1 addition & 0 deletions components/server/src/workspace/workspace-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ export class WorkspaceStarter {
"function:getEnvVars",
"function:setEnvVar",
"function:deleteEnvVar",
"function:trackEvent",

"resource:"+ScopedResourceGuard.marshalResourceScope({kind: "workspace", subjectID: workspace.id, operations: ["get", "update"]}),
"resource:"+ScopedResourceGuard.marshalResourceScope({kind: "workspaceInstance", subjectID: instance.id, operations: ["get", "update", "delete"]}),
Expand Down
9 changes: 9 additions & 0 deletions components/supervisor/frontend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ const loadingIDE = new Promise(resolve => window.addEventListener('DOMContentLoa
ideService.onDidChange(() => {
updateLoadingState();
updateCurrentFrame();

window.gitpod.service.server.trackEvent({
event: "status_rendered",
properties: {
workspaceId: gitpodServiceClient.info.latestInstance?.workspaceId,
phase: `ide-${ideService.state}`,
error: ideService.failureCause?.message,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also can be ideService.failureCause?.stack it would be interesting to capture it

},
});
});
//#endregion

Expand Down