Tracking Workflow progress

Hi, I’m having difficulties to understand from temporal SDK how can I gather all heartbeat values from all the activities to have some “progress bar” how workflow is working.

I’m trying to use Temporal for batch processing doing something similar to split-merge sample. I’d like to know how many items were processed at any given moment

2 Likes

Use DescribeWorkflowExecution API. Its result contains a list of pending activities including the values of last heartbeats.

1 Like

maxim, thanks for the pointer

and how can I convert *common.Payloads to my own type that I’ve passed to activity.RecordHeartbeat?
Also is there a way to get last heartbeat of finished activities or only their results?

Use DataConverter:

	dc := converter.GetDefaultDataConverter()
	var heartbeat MyHeartbeatType
	err := dc.FromPayloads(data, &heartbeat)

If activity times out (and retry policy doesn’t apply anymore) then the last heartbeat is included in the error received by the workflow.

If the activity completes successfully you have to include it in the result.