Skip to content

[server] Only alert on explicit system failures #12481

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 1 commit into from
Aug 29, 2022
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
6 changes: 5 additions & 1 deletion components/server/src/prometheus-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ const instanceStartsFailedTotal = new prometheusClient.Counter({
registers: [prometheusClient.register],
});

export type FailedInstanceStartReason = "clusterSelectionFailed" | "startOnClusterFailed" | "other";
export type FailedInstanceStartReason =
| "clusterSelectionFailed"
| "startOnClusterFailed"
| "imageBuildFailed"
| "other";
export function increaseFailedInstanceStartCounter(reason: FailedInstanceStartReason) {
instanceStartsFailedTotal.inc({ reason });
}
Expand Down
14 changes: 7 additions & 7 deletions components/server/src/workspace/workspace-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,11 @@ export class WorkspaceStarter {
if (rethrow) {
throw err;
} else {
log.error("error starting instance", err, { instanceId: instance.id });
let failedReason: FailedInstanceStartReason = "other";
TraceContext.setError({ span }, err);
log.error({ userId: user.id, instanceId: instance.id }, "error starting instance", err);
if (err instanceof StartInstanceError) {
failedReason = err.reason;
increaseFailedInstanceStartCounter(err.reason);
}
increaseFailedInstanceStartCounter(failedReason);
}

return { instanceID: instance.id };
Expand Down Expand Up @@ -765,7 +764,7 @@ export class WorkspaceStarter {
ideConfig: IDEConfig,
pvcEnabledForPrebuilds: boolean,
): Promise<WorkspaceInstance> {
const span = TraceContext.startSpan("buildWorkspaceImage", ctx);
const span = TraceContext.startSpan("newInstance", ctx);
Copy link
Member Author

Choose a reason for hiding this comment

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

ℹ️ This is a drive-by.

//#endregion IDE resolution TODO(ak) move to IDE service
// TODO: Compatible with ide-config not deployed, need revert after ide-config deployed
delete ideConfig.ideOptions.options["code-latest"];
Expand Down Expand Up @@ -1264,18 +1263,19 @@ export class WorkspaceStarter {

TraceContext.setError({ span }, err);
const looksLikeUserError = (msg: string): boolean => {
return msg.startsWith("build failed:");
return msg.startsWith("build failed:") || msg.startsWith("headless task failed:");
};
if (looksLikeUserError(message)) {
log.debug(
{ instanceId: instance.id, userId: user.id, workspaceId: workspace.id },
`workspace image build failed: ${message}`,
);
} else {
log.warn(
log.error(
{ instanceId: instance.id, userId: user.id, workspaceId: workspace.id },
`workspace image build failed: ${message}`,
);
err = new StartInstanceError("imageBuildFailed", err);
}
this.analytics.track({
userId: user.id,
Expand Down