-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure workflow_failed is incremented on NonDeterministicException #2141
Make sure workflow_failed is incremented on NonDeterministicException #2141
Conversation
@@ -255,10 +255,14 @@ private void applyServerHistory(long lastEventId, WorkflowHistoryIterator histor | |||
implementationOptions.getFailWorkflowExceptionTypes(); | |||
for (Class<? extends Throwable> failType : failTypes) { | |||
if (failType.isAssignableFrom(e.getClass())) { | |||
metricsScope.counter(MetricsType.WORKFLOW_FAILED_COUNTER).inc(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see completeWorkflow
increments this metric. Do these exceptions not make it to completeWorkflow
? Is there a common place that completeWorkflow
-based exceptions and these are turned to workflow failures that may be a better place to move the metric, e.g. WorkflowStateMachines.failWorkflow
? Or even if we don't want to change completeWorkflow
, is there a common place where WorkflowExecutionException
is caught and converted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these exceptions not make it to completeWorkflow
Correct, this code catches exceptions from the state machine, not the workflow code itself
Is there a common place that completeWorkflow-based exceptions and these are turned to workflow failures that may be a better place to move the metric, e.g. WorkflowStateMachines.failWorkflow
No
is there a common place where WorkflowExecutionException is caught and converted?
The only place would be when the SDK responds to the server, but that would require changing where all completion metrics are emitted. That work is captured here #1590. I was hopping to defer that work till later.
throw new WorkflowExecutionException( | ||
workflow.getWorkflowContext().mapWorkflowExceptionToFailure(e)); | ||
} | ||
} | ||
if (e instanceof WorkflowExecutionException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, what is the situation where e
is a WorkflowExecutionException
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it can happen today, but if workflowStateMachines.handleEvent(event, hasNext);
did throw a WorkflowExecutionException
it would lead to a workflow failure. So it is more future proofing, it also may be possible with some user interceptor could throw a WorkflowExecutionException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I feel better knowing we are asserting exactly 1 and so we will make sure dupe fail counts don't creep in if/when we refactor to a common place.
593c508
to
f3fb8e4
Compare
Make sure
workflow_failed
is incremented onNonDeterministicException
closes #2103