@@ -591,12 +591,11 @@ export class WorkspaceStarter {
591
591
if ( rethrow ) {
592
592
throw err ;
593
593
} else {
594
- log . error ( "error starting instance" , err , { instanceId : instance . id } ) ;
595
- let failedReason : FailedInstanceStartReason = "other" ;
594
+ TraceContext . setError ( { span } , err ) ;
595
+ log . error ( { userId : user . id , instanceId : instance . id } , "error starting instance" , err ) ;
596
596
if ( err instanceof StartInstanceError ) {
597
- failedReason = err . reason ;
597
+ increaseFailedInstanceStartCounter ( err . reason ) ;
598
598
}
599
- increaseFailedInstanceStartCounter ( failedReason ) ;
600
599
}
601
600
602
601
return { instanceID : instance . id } ;
@@ -765,7 +764,7 @@ export class WorkspaceStarter {
765
764
ideConfig : IDEConfig ,
766
765
pvcEnabledForPrebuilds : boolean ,
767
766
) : Promise < WorkspaceInstance > {
768
- const span = TraceContext . startSpan ( "buildWorkspaceImage " , ctx ) ;
767
+ const span = TraceContext . startSpan ( "newInstance " , ctx ) ;
769
768
//#endregion IDE resolution TODO(ak) move to IDE service
770
769
// TODO: Compatible with ide-config not deployed, need revert after ide-config deployed
771
770
delete ideConfig . ideOptions . options [ "code-latest" ] ;
@@ -1264,18 +1263,19 @@ export class WorkspaceStarter {
1264
1263
1265
1264
TraceContext . setError ( { span } , err ) ;
1266
1265
const looksLikeUserError = ( msg : string ) : boolean => {
1267
- return msg . startsWith ( "build failed:" ) ;
1266
+ return msg . startsWith ( "build failed:" ) || msg . startsWith ( "headless task failed:" ) ;
1268
1267
} ;
1269
1268
if ( looksLikeUserError ( message ) ) {
1270
1269
log . debug (
1271
1270
{ instanceId : instance . id , userId : user . id , workspaceId : workspace . id } ,
1272
1271
`workspace image build failed: ${ message } ` ,
1273
1272
) ;
1274
1273
} else {
1275
- log . warn (
1274
+ log . error (
1276
1275
{ instanceId : instance . id , userId : user . id , workspaceId : workspace . id } ,
1277
1276
`workspace image build failed: ${ message } ` ,
1278
1277
) ;
1278
+ err = new StartInstanceError ( "imageBuildFailed" , err ) ;
1279
1279
}
1280
1280
this . analytics . track ( {
1281
1281
userId : user . id ,
0 commit comments