SbloodyS commented on code in PR #18082:
URL: 
https://github.com/apache/dolphinscheduler/pull/18082#discussion_r2958104505


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/metrics/WorkflowInstanceMetrics.java:
##########
@@ -90,6 +92,39 @@ public void 
incWorkflowInstanceByStateAndWorkflowDefinitionCode(final String sta
                 .increment();
     }
 
+    public void recordWorkflowInstanceSubmit(final Long 
workflowDefinitionCode) {
+        incWorkflowInstanceByStateAndWorkflowDefinitionCode("submit", 
String.valueOf(workflowDefinitionCode));
+    }
+
+    public void recordWorkflowInstanceTimeout(final Long 
workflowDefinitionCode) {
+        incWorkflowInstanceByStateAndWorkflowDefinitionCode("timeout", 
String.valueOf(workflowDefinitionCode));
+    }
+
+    public void recordWorkflowInstanceFailover(final Long 
workflowDefinitionCode) {
+        incWorkflowInstanceByStateAndWorkflowDefinitionCode("failover", 
String.valueOf(workflowDefinitionCode));
+    }
+
+    public void recordWorkflowInstanceFinish(final WorkflowExecutionStatus 
workflowExecutionStatus,
+                                             final Long 
workflowDefinitionCode) {
+        if (workflowExecutionStatus == null || 
!workflowExecutionStatus.isFinalState()) {
+            return;
+        }
+        incWorkflowInstanceByStateAndWorkflowDefinitionCode("finish", 
String.valueOf(workflowDefinitionCode));
+        switch (workflowExecutionStatus) {
+            case SUCCESS:
+                incWorkflowInstanceByStateAndWorkflowDefinitionCode("success", 
String.valueOf(workflowDefinitionCode));
+                break;
+            case FAILURE:
+                incWorkflowInstanceByStateAndWorkflowDefinitionCode("fail", 
String.valueOf(workflowDefinitionCode));
+                break;
+            case STOP:
+                incWorkflowInstanceByStateAndWorkflowDefinitionCode("stop", 
String.valueOf(workflowDefinitionCode));
+                break;
+            default:
+                break;
+        }
+    }

Review Comment:
   Done. PTAL @ruanwenjun 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to