diff --git a/addons/common/monitoring/core/src/main/java/org/kie/kogito/monitoring/core/common/process/MetricsProcessEventListener.java b/addons/common/monitoring/core/src/main/java/org/kie/kogito/monitoring/core/common/process/MetricsProcessEventListener.java index 007c1aa4bde..1de0307b1af 100644 --- a/addons/common/monitoring/core/src/main/java/org/kie/kogito/monitoring/core/common/process/MetricsProcessEventListener.java +++ b/addons/common/monitoring/core/src/main/java/org/kie/kogito/monitoring/core/common/process/MetricsProcessEventListener.java @@ -179,7 +179,7 @@ public void beforeNodeLeft(ProcessNodeLeftEvent event) { } private void recordNodeDuration(DistributionSummary summary, KogitoNodeInstance instance, TimeUnit target) { - if (instance.getTriggerTime() != null) { + if (instance.getTriggerTime() != null && instance.getLeaveTime() != null) { double duration = target.convert(instance.getLeaveTime().getTime() - instance.getTriggerTime().getTime(), TimeUnit.MILLISECONDS); summary.record(duration); LOGGER.debug("Recorded {} {} because of node {} for summary {}", duration, target, instance.getNode().getName(), summary.getId().getName()); diff --git a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/FaultNodeInstance.java b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/FaultNodeInstance.java index 2340848f7b0..ec8fa4b948f 100755 --- a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/FaultNodeInstance.java +++ b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/FaultNodeInstance.java @@ -88,6 +88,7 @@ public void internalTrigger(KogitoNodeInstance from, String type) { if (getNode().getMetaData().get("hidden") != null) { hidden = true; } + leaveTime = new Date(); if (!hidden) { InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); ((InternalProcessRuntime) kruntime.getProcessRuntime()) diff --git a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/SplitInstance.java b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/SplitInstance.java index 5d6d2c4d61a..6319299d207 100755 --- a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/SplitInstance.java +++ b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/SplitInstance.java @@ -230,6 +230,7 @@ protected void executeStrategy(Split split, String type) { if (getNode().getMetaData().get("hidden") != null) { hidden = true; } + leaveTime = new Date(); InternalKnowledgeRuntime kruntime = getProcessInstance().getKnowledgeRuntime(); if (!hidden) { ((InternalProcessRuntime) kruntime.getProcessRuntime())