failsafe-lib / failsafe

Fault tolerance and resilience patterns for the JVM
https://failsafe.dev
Apache License 2.0
4.2k stars 297 forks source link

Feature: Expose `ExecutionContext.getElapsedAttemptTime` on `ExecutionEvent` #272

Closed derekguist closed 3 years ago

derekguist commented 3 years ago

ExecutionEvent currently exposes some of the useful data on ExecutionContext but not all, specifically getElapsedAttemptTime could be useful. The use case I have is tracking metrics for how long individual attempts take.

I was attempting to do this in an onRetry handler. A question is whether getElapsedAttemptTime would return the elapsed time of the previous attempt at this point. If not, then presumably it would return the elapsed time of the previous attempt in an onFailedAttempt handler. Some documentation would clearly be needed to indicate what attempt this is tracking at various stages of the retry cycle.

jhalterman commented 3 years ago

This was released in 2.4.1.