Is there a metric indicating workflow history events count?

So I have a workflow which may crash on 50000 history events, is there some kind of metric or whatever that I can use to see if workflow history exceeded X amount of events?

Hello @Nicholas_Neutron

History service emits history_count metric, which is histogram and measures history count distribution, but I don’t think this is what you are looking for.

For a specific execution, you can use tctl wf desc -w <wfid> -r <runid> and find workflowExecutionInfo.historyLength

or via code using [DescribeWorkflowExecutionResponse]

    DescribeWorkflowExecutionResponse resp =
    ...
    resp.getWorkflowExecutionInfo().getHistoryLength()

With the next SDK release, you will be able to access the history length from your workflow code