Get used flow nodes from the processEngine

Hello,

im trying to build a process that reports the total used flow nodes and is supposed to run in each shared engine to report that into a timeseries database.
Does someone know how i can access the number of used flow nodes from within my process?

Best regards
Philipp

I think i found it, is this the correct query? I want to use this to visualize it in a graph, but also for automated license usage reporting for camunda ee later on.

Long totalFlowNodeInstances = execution.getProcessEngine().getManagementService().createMetricsQuery()
            .name(Metrics.ACTIVTY_INSTANCE_START)
            .sum();

NVM, i just found this confirming it:

Flow node instances is the sum of the metric activity-instance-start , documented here: https://docs.camunda.org/manual/7.8/user-guide/process-engine/metrics/#built-in-metrics , i.e. it counts whenever a BPMN or CMMN activity is started.