You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For standard (non suspend functions) it is possible to use record function to measure method invocation time:
Timer.builder("method.timed")
.register(meterRegistry)
.record { fn() } // fn() is a standard, non suspend function
However, it is not possible to call a suspend function from within record block:
Timer.builder("method.timed")
.register(meterRegistry)
.record { suspendFn() } // Suspension functions can be called only within coroutine body
The support for suspend functions should be added to the library.
Rationale
Suspend functions are popular for non-blocking API, and it is currently not possible to measure time needed to call suspend functions without having a custom function to record the time.
Additional context
Maybe this could be added as a extension function to the Timer interface.
The text was updated successfully, but these errors were encountered:
We would review a pull request to add this functionality. There is a similar pull request open now for adding an extension function to Observation to support suspend functions - see #4823.
Please describe the feature request.
For standard (non suspend functions) it is possible to use
record
function to measure method invocation time:However, it is not possible to call a suspend function from within record block:
The support for suspend functions should be added to the library.
Rationale
Suspend functions are popular for non-blocking API, and it is currently not possible to measure time needed to call suspend functions without having a custom function to record the time.
Additional context
Maybe this could be added as a extension function to the Timer interface.
The text was updated successfully, but these errors were encountered: