Disable emitting of completion metrics when replaying workflow
@@ -89,22 +89,30 @@ final class ReplayWorkflowExecutor {
private void completeWorkflow() {
if (cancelRequested) {
workflowStateMachines.cancelWorkflow();
+ if (!workflowStateMachines.isReplaying()) {
metricsScope.counter(MetricsType.WORKFLOW_CANCELED_COUNTER).inc(1);
+ }
} else if (failure != null) {
workflowStateMachines.failWorkflow(failure.getFailure());
+ if (!workflowStateMachines.isReplaying()) {
metricsScope.counter(MetricsType.WORKFLOW_FAILED_COUNTER).inc(1);
+ }
} else {
ContinueAsNewWorkflowExecutionCommandAttributes attributes =
context.getContinueAsNewOnCompletion();
if (attributes != null) {
workflowStateMachines.continueAsNewWorkflow(attributes);
+ if (!workflowStateMachines.isReplaying()) {
metricsScope.counter(MetricsType.WORKFLOW_CONTINUE_AS_NEW_COUNTER).inc(1);
+ }
} else {
Optional<Payloads> workflowOutput = workflow.getOutput();
workflowStateMachines.completeWorkflow(workflowOutput);
+ if (!workflowStateMachines.isReplaying()) {
metricsScope.counter(MetricsType.WORKFLOW_COMPLETED_COUNTER).inc(1);
}
}
+ }
com.uber.m3.util.Duration d =
ProtobufTimeUtils.toM3Duration(
