use of org.kie.kogito.internal.process.runtime.KogitoWorkItemNodeInstance in project kogito-runtimes by kiegroup.
the class MetricsProcessEventListener method beforeNodeLeft.
@Override
public void beforeNodeLeft(ProcessNodeLeftEvent event) {
LOGGER.debug("Before Node left event: {}", event);
final KogitoNodeInstance nodeInstance = (KogitoNodeInstance) event.getNodeInstance();
if (nodeInstance instanceof KogitoWorkItemNodeInstance) {
KogitoWorkItemNodeInstance wi = (KogitoWorkItemNodeInstance) nodeInstance;
if (wi.getTriggerTime() != null) {
final String name = (String) wi.getWorkItem().getParameters().getOrDefault("TaskName", wi.getWorkItem().getName());
final double duration = millisToSeconds(wi.getLeaveTime().getTime() - wi.getTriggerTime().getTime());
getWorkItemsDurationSummary(name).record(duration);
LOGGER.debug("Work Item {}, duration: {}s", name, duration);
}
}
}
Aggregations