Calcualte Flow Node Instance Calculation

Hi ,

Is there way options available to calculate this Flow Node Instance in cammunda BPMN flows from history tables

Hi @stephenbalben_joel ,

You can use the following REST API

GET /metrics?name=flow-node-instances&startDate=1970-01-01T01:45:00.000%2b0200&endDate=1970-01-01T02:00:00.000%2b0200

or below API to get the sum

GET /metrics/flow-node-instances/sum?startDate=2015-01-01T00:00:00.000%2b0200

Get Metrics in Interval | docs.camunda.org

Get Sum | docs.camunda.org

1 Like

Thanks Hassang

Yes, you can calculate Flow Node Instances in Camunda BPMN flows using the history tables provided by the Camunda engine.

You can query the ACT_HI_ACTINST table, which stores historic activity instances. Each row in this table represents a Flow Node Instance executed during a process instance.

To calculate the total number of Flow Node Instances for a specific process, you can use a SQL query like:

sql
Copy
Edit
SELECT COUNT(*)
FROM ACT_HI_ACTINST
WHERE PROC_INST_ID_ = ‘your_process_instance_id’;
If you’re using the REST API, you can also retrieve this information via:

bash
Copy
Edit
GET /history/activity-instance?processInstanceId=your_process_instance_id

This returns all flow node instances (activities) executed for a given process instance. You can count them programmatically from the returned array.