Workflow.retry() results in more actions?

We are using Workflow.retry with the java sdk and wanted to know the following:

  1. Is there a way to get the retry attempt number inside the Workflow.retry method? Similar to Activity.getExecutionContext().getInfo().getAttempt()?
  2. We also observed that when using Workflow.retry, in the temporal UI, Mutable Side Effect event is recorded along with Timer Started and Timer Fired per retry attempt. Does this mean using Workflow.retry results in significantly more number of Actions and hence is inherently costlier?
  1. you would need to maintain attempt count via counter var in your workflow code that you can initialize to 1 and increment in your procedure code you give to Workflow.retry

  2. This is i believe expected, and yes you can use Workflow.retry / Async.retry when you want to retry a group/sequence of activities, or more complex grouping of activities and child workflows together.
    If you mean if its going to create more events (and actions) than retries of single activity then yes. In case Workflow.retry needs to retry for long time you need to also check for continueAsNewSuggested flag and continueasnew if needed