@@ -132,7 +132,7 @@ export class LivenessManager {
132132
133133 if ( reason === 'timeout' && this . pingTimeoutConsecutiveCount >= this . options . consecutiveTimeoutLimit ) {
134134 this . debug ( 'Subprocess failed to respond to pings %d consecutive times. Attempting restart...' , this . options . consecutiveTimeoutLimit ) ;
135- this . restartProcess ( ) ;
135+ this . restartProcess ( 'Too many pings timed out' ) ;
136136 return false ;
137137 }
138138
@@ -164,17 +164,21 @@ export class LivenessManager {
164164 return ;
165165 }
166166
167+ let reason : string ;
168+
167169 // Otherwise we try to restart the subprocess, if possible
168170 if ( signal ) {
169171 this . debug ( 'App has been killed (%s). Attempting restart #%d...' , signal , this . restartCount + 1 ) ;
172+ reason = `App has been killed with signal ${ signal } ` ;
170173 } else {
171174 this . debug ( 'App has exited with code %d. Attempting restart #%d...' , exitCode , this . restartCount + 1 ) ;
175+ reason = `App has exited with code ${ exitCode } ` ;
172176 }
173177
174- this . restartProcess ( ) ;
178+ this . restartProcess ( reason ) ;
175179 }
176180
177- private restartProcess ( ) {
181+ private restartProcess ( reason : string ) {
178182 if ( this . restartCount >= this . options . maxRestarts ) {
179183 this . debug ( 'Limit of restarts reached (%d). Aborting restart...' , this . options . maxRestarts ) ;
180184 this . controller . stopApp ( ) ;
@@ -184,6 +188,7 @@ export class LivenessManager {
184188 this . pingTimeoutConsecutiveCount = 0 ;
185189 this . restartCount ++ ;
186190 this . restartLog . push ( {
191+ reason,
187192 restartedAt : new Date ( ) ,
188193 source : 'liveness-manager' ,
189194 pid : this . subprocess . pid ,
0 commit comments