@@ -152,6 +152,11 @@ public void preRestart(final Throwable reason, final Optional<Object> message) t
152
152
super .preRestart (reason , message );
153
153
154
154
_periodicMetrics .recordCounter ("actors/http_post_sink/restarted" , 1 );
155
+ LOGGER .error ()
156
+ .setMessage ("Actor restarted" )
157
+ .addData ("sink" , _sink )
158
+ .setThrowable (reason )
159
+ .log ();
155
160
}
156
161
157
162
/**
@@ -385,7 +390,21 @@ private void fireNextRequest() {
385
390
_periodicMetrics .recordTimer (_inQueueLatencyName , latencyInMillis , Optional .of (TimeUnit .MILLISECONDS ));
386
391
387
392
_inflightRequestsCount ++;
388
- fireRequest (requestEntry , 1 );
393
+ try {
394
+ fireRequest (requestEntry , 1 );
395
+ // CHECKSTYLE.OFF: IllegalCatch - We need to catch everything here
396
+ } catch (final RuntimeException e ) {
397
+ // CHECKSTYLE.ON: IllegalCatch
398
+ _inflightRequestsCount --;
399
+ POST_ERROR_LOGGER .error ()
400
+ .setMessage ("Error while sending request" )
401
+ .addData ("sink" , _sink )
402
+ .addData ("request" , requestEntry )
403
+ .addContext ("actor" , self ())
404
+ .setThrowable (e )
405
+ .log ();
406
+ throw e ;
407
+ }
389
408
}
390
409
}
391
410
@@ -402,9 +421,9 @@ private void fireRequest(final RequestEntry request, final int attempt) {
402
421
Optional .of (TimeUnit .MILLISECONDS ));
403
422
if (err == null ) {
404
423
if (_acceptedStatusCodes .contains (result .getStatusCode ())) {
405
- return new PostSuccess (attempt , request , result );
424
+ return new PostSuccess (attempt , request , result );
406
425
} else {
407
- return new PostRejected (attempt , request , result );
426
+ return new PostRejected (attempt , request , result );
408
427
}
409
428
} else {
410
429
return new PostFailure (attempt , request , err );
0 commit comments