File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
src/main/java/com/uber/cadence/internal/replay Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class ReplayDecider implements Decider {
7979
8080 private final Scope metricsScope ;
8181
82- private long wfStartTime = - 1 ;
82+ private final long wfStartTimeNanos ;
8383
8484 private final WorkflowExecutionStartedEventAttributes startedEvent ;
8585
@@ -102,6 +102,7 @@ class ReplayDecider implements Decider {
102102 throw new IllegalArgumentException (
103103 "First event in the history is not WorkflowExecutionStarted" );
104104 }
105+ wfStartTimeNanos = decisionTask .getHistory ().getEvents ().get (0 ).getTimestamp ();
105106
106107 context =
107108 new DecisionContextImpl (
@@ -288,12 +289,10 @@ private void completeWorkflow() {
288289 }
289290 }
290291
291- if (wfStartTime != -1 ) {
292- long nanoTime =
293- TimeUnit .NANOSECONDS .convert (System .currentTimeMillis (), TimeUnit .MILLISECONDS );
294- com .uber .m3 .util .Duration d = com .uber .m3 .util .Duration .ofNanos (nanoTime - wfStartTime );
295- metricsScope .timer (MetricsType .WORKFLOW_E2E_LATENCY ).record (d );
296- }
292+ long nanoTime =
293+ TimeUnit .NANOSECONDS .convert (System .currentTimeMillis (), TimeUnit .MILLISECONDS );
294+ com .uber .m3 .util .Duration d = com .uber .m3 .util .Duration .ofNanos (nanoTime - wfStartTimeNanos );
295+ metricsScope .timer (MetricsType .WORKFLOW_E2E_LATENCY ).record (d );
297296 }
298297
299298 private void updateTimers () {
You can’t perform that action at this time.
0 commit comments