@@ -303,6 +303,11 @@ func (p *Process) Shutdown() {
303
303
// stopCommand will send a SIGTERM to the process and wait for it to exit.
304
304
// If it does not exit within 5 seconds, it will send a SIGKILL.
305
305
func (p * Process ) stopCommand (sigtermTTL time.Duration ) {
306
+ stopStartTime := time .Now ()
307
+ defer func () {
308
+ p .proxyLogger .Debugf ("Process [%s] stopCommand took %v" , p .ID , time .Since (stopStartTime ))
309
+ }()
310
+
306
311
sigtermTimeout , cancelTimeout := context .WithTimeout (context .Background (), sigtermTTL )
307
312
defer cancelTimeout ()
308
313
@@ -369,6 +374,8 @@ func (p *Process) checkHealthEndpoint(healthURL string) error {
369
374
}
370
375
371
376
func (p * Process ) ProxyRequest (w http.ResponseWriter , r * http.Request ) {
377
+ requestBeginTime := time .Now ()
378
+ var startDuration time.Duration
372
379
373
380
// prevent new requests from being made while stopping or irrecoverable
374
381
currentState := p .CurrentState ()
@@ -385,11 +392,13 @@ func (p *Process) ProxyRequest(w http.ResponseWriter, r *http.Request) {
385
392
386
393
// start the process on demand
387
394
if p .CurrentState () != StateReady {
395
+ beginStartTime := time .Now ()
388
396
if err := p .start (); err != nil {
389
397
errstr := fmt .Sprintf ("unable to start process: %s" , err )
390
398
http .Error (w , errstr , http .StatusBadGateway )
391
399
return
392
400
}
401
+ startDuration = time .Since (beginStartTime )
393
402
}
394
403
395
404
proxyTo := p .config .Proxy
@@ -433,4 +442,8 @@ func (p *Process) ProxyRequest(w http.ResponseWriter, r *http.Request) {
433
442
return
434
443
}
435
444
}
445
+
446
+ totalTime := time .Since (requestBeginTime )
447
+ p .proxyLogger .Debugf ("Process [%s] request %s - start: %v, total: %v" ,
448
+ p .ID , r .RequestURI , startDuration , totalTime )
436
449
}
0 commit comments