[Improvement-18039][Metrics] Add missing metrics for workflow and task state transitions#18038
[Improvement-18039][Metrics] Add missing metrics for workflow and task state transitions#18038sanjana2505006 wants to merge 1 commit into
Conversation
990a504 to
6176e33
Compare
SbloodyS
left a comment
There was a problem hiding this comment.
Please follow the pull request notice and create an issue first. @sanjana2505006
9c47397 to
c0013cc
Compare
|
Please check the failed CI. @sanjana2505006 |
|
Sure, @SbloodyS, I have an exam today. I’ll take a look at the failed CI once I’m done 😃... |
2a2647b to
edeef4e
Compare
|
Hello @SbloodyS, I've updated the PR to address the CI failures. Please have a look when you have time and share your feedback. Thank you! |
|
UT still failed. @sanjana2505006 |
ruanwenjun
left a comment
There was a problem hiding this comment.
Thanks for your PR.
It might be better to add event metrics first.
WorkflowEventBusFireWorker#doFireSingleWorkflowEventBus
We may need to provide a public method to handle changes in instance state, and then use listeners or similar mechanisms to update the metrics.
So it’s not suitable to add this directly at the moment, but I’ll be doing that soon.
f4919d7 to
e30a3d3
Compare
…sage - Add back empty line in AbstractTaskStateAction.java line 199 as requested - Add incTaskInstanceByLifecycleEvent method to TaskMetrics to use TaskLifecycleEventType directly - Update WorkflowEventBusFireWorker to use new method instead of string comparisons - Add comprehensive tests for new lifecycle event method Addresses feedback from SbloodyS and ruanwenjun on PR apache#18038
83a0f5d to
7469149
Compare
|
|
@SbloodyS I've updated the pr according to your feedback , please have a look |
817d2aa to
b5ae074
Compare
| public void incTaskInstanceByState(final String state) { | ||
| if (taskInstanceCounters.get(state) == null) { | ||
| return; | ||
| } | ||
| taskInstanceCounters.get(state).increment(); | ||
| } |
There was a problem hiding this comment.
We should store TaskLifecycleEventType.name() directly. You can refer to org.apache.dolphinscheduler.server.master.metrics.WorkflowInstanceMetrics
| } | ||
|
|
||
| @Test | ||
| void testCleanUpWorkflowInstanceCountMetricsByDefinitionCode() { |
There was a problem hiding this comment.
After rebasing onto latest dev, WorkflowInstanceMetricsTest#testCleanUp... may fail to compile because cleanUpWorkflowInstanceCountMetricsByDefinitionCode was removed in #18205. Also, counter tags should use WorkflowExecutionStatus.name() (e.g. SUBMITTED_SUCCESS), not submit/fail.
There was a problem hiding this comment.
Thanks for catching that. Rebased onto latest dev, removed the cleanup test (method was dropped in #18205), and updated all counter tag assertions to use WorkflowExecutionStatus.name() — e.g. SUBMITTED_SUCCESS instead of "submit".
b5ae074 to
e6c6faf
Compare
…k state transitions Record workflow instance state changes in AbstractWorkflowStateAction, workflow generation duration in WorkflowExecutionFactory, and task lifecycle metrics via TaskLifecycleEventType in WorkflowEventBusFireWorker. Add unit tests for TaskMetrics and WorkflowInstanceMetrics.
e6c6faf to
65164d6
Compare
|
You should check failed UT. @sanjana2505006 |


Purpose
This PR adds missing metrics to the Master module to improve visibility into workflow and task execution states. It addresses the gap where several metrics classes were defined but not utilized in the core execution flow.
Proposed Changes
AbstractWorkflowStateAction.AbstractTaskStateAction.TaskTimeoutLifecycleEventHandler.WorkflowExecutionRunnableFactory.Verification
mvn spotless:apply.This PR closes #18039