Timelimiter metrics not calculated when using resilince4j-kotlin
See original GitHub issueResilience4j version: 1.5.0
Kotlin version: 1.4.10
Timelimiter metrics are not calculated when using the resilience4j-kotlin module, on the Timelimiter.decorateSuspendFunction
extension function.
Probably the counter resilience4j_timelimiter_calls_total
should increment whenever a TimeoutCancellationException
is thrown in the extension function, however its value remains 0.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Implementing Timeouts with Resilience4j - Reflectoring
Resilience4j's TimeLimiter can be used to set time limits (timeouts) on asynchronous operations implemented with CompleteableFuture s. The ...
Read more >Micrometer - resilience4j
The following code snippet shows how to bind CircuitBreaker metrics to a MeterRegistry . It binds all CircuitBreaker instances at once and registers...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The behaviour’s a little more fine fineTuned than I expected, although mostly related to kotlin’s way of dealing with
CancellationException
sI’m wrapping my timeLimiter into a circuitbreaker, such that I can stop hammering an upstream service if it’s getting really slow.
Now, if the timeLimiter returns in an error state (calling the the
onError
method), the circuitbreaker doesn’t pick up the underlying event as an Error as well, and there are no metrics on the event as well, which is something I don’t really get (yet). It seems that an error in terms of a timelimiter should never really occur?Because of the intricate behaviour of kotlin’s
TimeoutCancellationException
s, for which I want to be quite explicit in my usage, I did the following:With that, both my circuitbreaker and timelimiter can works as expected, and all exceptions are recorded ‘properly’. Timeouts are registered as failed requests in my circuitbreaker, and requests that failed otherwise will both be registered in the timeLimiter metrics as well as the circuitbreaker metrics (which makes sense, since they’re nested). I’m not familiar with the approach in spring-boot with the aspectj annotations, but I’d expect a similar behaviour there.
The changes I’m making to resilience:
TimeoutCancellationException
s asjava.util.concurrent.TimeoutException
s, such that the event handler recognises this as a timeout.Yes, please