softwaremill / ox

Safe direct style concurrency and resiliency for Scala on the JVM

Home Page:https://ox.softwaremill.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add side-effecting callback to retry attempts

rucek opened this issue · comments

When the retry mechanism performs another attempt to run the operation, it might be useful to execute a side effect - like logging or updating metrics.

Some things to consider:

  • how much context should such a callback have (e.g. which attempt is this)
  • should the callback be executed before or after the attempt? In the latter case it could include the result, which - particularly in case of error - might be useful for logging/metrics. Or perhaps both such callbacks should be available, so that we can hook into the retry lifecycle even more?