33import com .google .common .annotations .VisibleForTesting ;
44import com .google .protobuf .InvalidProtocolBufferException ;
55import com .google .protobuf .util .Timestamps ;
6- import com .uber .m3 .tally .Scope ;
76import io .temporal .api .command .v1 .ContinueAsNewWorkflowExecutionCommandAttributes ;
87import io .temporal .api .common .v1 .Payloads ;
98import io .temporal .api .history .v1 .HistoryEvent ;
1413import io .temporal .api .update .v1 .Input ;
1514import io .temporal .api .update .v1 .Request ;
1615import io .temporal .failure .CanceledFailure ;
17- import io .temporal .internal .common .FailureUtils ;
1816import io .temporal .internal .common .ProtobufTimeUtils ;
1917import io .temporal .internal .common .UpdateMessage ;
2018import io .temporal .internal .statemachines .WorkflowStateMachines ;
2119import io .temporal .internal .sync .SignalHandlerInfo ;
2220import io .temporal .internal .sync .UpdateHandlerInfo ;
2321import io .temporal .internal .worker .WorkflowExecutionException ;
24- import io .temporal .worker .MetricsType ;
2522import io .temporal .worker .NonDeterministicException ;
2623import io .temporal .workflow .HandlerUnfinishedPolicy ;
2724import java .util .List ;
@@ -63,16 +60,13 @@ final class ReplayWorkflowExecutor {
6360
6461 private final ReplayWorkflowContextImpl context ;
6562
66- private final Scope metricsScope ;
67-
6863 public ReplayWorkflowExecutor (
6964 ReplayWorkflow workflow ,
7065 WorkflowStateMachines workflowStateMachines ,
7166 ReplayWorkflowContextImpl context ) {
7267 this .workflow = workflow ;
7368 this .workflowStateMachines = workflowStateMachines ;
7469 this .context = context ;
75- this .metricsScope = context .getMetricsScope ();
7670 }
7771
7872 public void eventLoop () {
@@ -131,12 +125,8 @@ private void completeWorkflow(@Nullable WorkflowExecutionException failure) {
131125
132126 if (context .isCancelRequested ()) {
133127 workflowStateMachines .cancelWorkflow ();
134- metricsScope .counter (MetricsType .WORKFLOW_CANCELED_COUNTER ).inc (1 );
135128 } else if (failure != null ) {
136129 workflowStateMachines .failWorkflow (failure .getFailure ());
137- if (!FailureUtils .isBenignApplicationFailure (failure .getFailure ())) {
138- metricsScope .counter (MetricsType .WORKFLOW_FAILED_COUNTER ).inc (1 );
139- }
140130 } else {
141131 ContinueAsNewWorkflowExecutionCommandAttributes attributes =
142132 context .getContinueAsNewOnCompletion ();
@@ -152,23 +142,17 @@ private void completeWorkflow(@Nullable WorkflowExecutionException failure) {
152142 // This way attributes will need to be carried over in the mutable state and the flow
153143 // generally will be aligned with the flow of other commands.
154144 workflowStateMachines .continueAsNewWorkflow (attributes );
155-
156- // TODO Issue #1590
157- metricsScope .counter (MetricsType .WORKFLOW_CONTINUE_AS_NEW_COUNTER ).inc (1 );
158145 } else {
159146 Optional <Payloads > workflowOutput = workflow .getOutput ();
160147 workflowStateMachines .completeWorkflow (workflowOutput );
161-
162- // TODO Issue #1590
163- metricsScope .counter (MetricsType .WORKFLOW_COMPLETED_COUNTER ).inc (1 );
164148 }
165149 }
166150
167151 com .uber .m3 .util .Duration d =
168152 ProtobufTimeUtils .toM3Duration (
169153 Timestamps .fromMillis (System .currentTimeMillis ()),
170154 Timestamps .fromMillis (context .getRunStartedTimestampMillis ()));
171- metricsScope . timer ( MetricsType . WORKFLOW_E2E_LATENCY ). record (d );
155+ workflowStateMachines . setPostCompletionEndToEndLatency (d );
172156 }
173157
174158 public void handleWorkflowExecutionCancelRequested (HistoryEvent event ) {
0 commit comments