@@ -45,11 +45,13 @@ func InterpreterImpl(
45
45
})
46
46
} else if provider .IsApplicationError (retErr ) {
47
47
event .Handle (iwfidl.IwfEvent {
48
- EventType : iwfidl .WORKFLOW_FAIL_EVENT ,
49
- WorkflowType : input .IwfWorkflowType ,
50
- WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
51
- WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
52
- SearchAttributes : sas ,
48
+ EventType : iwfidl .WORKFLOW_FAIL_EVENT ,
49
+ WorkflowType : input .IwfWorkflowType ,
50
+ WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
51
+ WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
52
+ SearchAttributes : sas ,
53
+ StartTimestampInMs : ptr .Any (provider .GetWorkflowInfo (ctx ).WorkflowStartTime .UnixMilli ()),
54
+ EndTimestampInMs : ptr .Any (provider .Now (ctx ).UnixMilli ()),
53
55
})
54
56
}
55
57
}
@@ -165,11 +167,12 @@ func InterpreterImpl(
165
167
if ! input .IsResumeFromContinueAsNew {
166
168
if ! provider .IsReplaying (ctx ) {
167
169
event .Handle (iwfidl.IwfEvent {
168
- EventType : iwfidl .WORKFLOW_START_EVENT ,
169
- WorkflowType : input .IwfWorkflowType ,
170
- WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
171
- WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
172
- SearchAttributes : persistenceManager .GetAllSearchAttributes (),
170
+ EventType : iwfidl .WORKFLOW_START_EVENT ,
171
+ WorkflowType : input .IwfWorkflowType ,
172
+ WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
173
+ WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
174
+ SearchAttributes : persistenceManager .GetAllSearchAttributes (),
175
+ StartTimestampInMs : ptr .Any (provider .GetWorkflowInfo (ctx ).WorkflowStartTime .UnixMilli ()),
173
176
})
174
177
}
175
178
// it's possible that a workflow is started without any starting state
@@ -596,18 +599,19 @@ func processStateExecution(
596
599
saLoadingPolicy := compatibility .GetWaitUntilApiSearchAttributesLoadingPolicy (state .StateOptions )
597
600
doLoadingPolicy := compatibility .GetWaitUntilApiDataObjectsLoadingPolicy (state .StateOptions )
598
601
602
+ stateWaitUntilApiStartTime := provider .Now (ctx ).UnixMilli ()
599
603
if ! provider .IsReplaying (ctx ) {
600
604
event .Handle (iwfidl.IwfEvent {
601
- EventType : iwfidl .STATE_WAIT_UNTIL_EE_START_EVENT ,
602
- WorkflowType : basicInfo .IwfWorkflowType ,
603
- WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
604
- WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
605
- StateId : ptr .Any (state .StateId ),
606
- StateExecutionId : ptr .Any (stateExeId ),
607
- SearchAttributes : persistenceManager .GetAllSearchAttributes (),
605
+ EventType : iwfidl .STATE_WAIT_UNTIL_EE_START_EVENT ,
606
+ WorkflowType : basicInfo .IwfWorkflowType ,
607
+ WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
608
+ WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
609
+ StateId : ptr .Any (state .StateId ),
610
+ StateExecutionId : ptr .Any (stateExeId ),
611
+ StartTimestampInMs : ptr .Any (stateWaitUntilApiStartTime ),
612
+ SearchAttributes : persistenceManager .GetAllSearchAttributes (),
608
613
})
609
614
}
610
- stateWaitUntilApiStartTime := provider .Now (ctx ).UnixMilli ()
611
615
errStartApi = provider .ExecuteActivity (& startResponse , configer .ShouldOptimizeActivity (), ctx ,
612
616
waitUntilApi , provider .GetBackendType (), service.StateStartActivityInput {
613
617
IwfWorkerUrl : basicInfo .IwfWorkerUrl ,
@@ -636,13 +640,15 @@ func processStateExecution(
636
640
})
637
641
} else {
638
642
event .Handle (iwfidl.IwfEvent {
639
- EventType : iwfidl .STATE_WAIT_UNTIL_EE_FAIL_EVENT ,
640
- WorkflowType : basicInfo .IwfWorkflowType ,
641
- WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
642
- WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
643
- StateId : ptr .Any (state .StateId ),
644
- StateExecutionId : ptr .Any (stateExeId ),
645
- SearchAttributes : persistenceManager .GetAllSearchAttributes (),
643
+ EventType : iwfidl .STATE_WAIT_UNTIL_EE_FAIL_EVENT ,
644
+ WorkflowType : basicInfo .IwfWorkflowType ,
645
+ WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
646
+ WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
647
+ StateId : ptr .Any (state .StateId ),
648
+ StateExecutionId : ptr .Any (stateExeId ),
649
+ StartTimestampInMs : ptr .Any (stateWaitUntilApiStartTime ),
650
+ EndTimestampInMs : ptr .Any (provider .Now (ctx ).UnixMilli ()),
651
+ SearchAttributes : persistenceManager .GetAllSearchAttributes (),
646
652
})
647
653
}
648
654
}
@@ -872,18 +878,19 @@ func invokeStateExecute(
872
878
ctx = provider .WithActivityOptions (ctx , activityOptions )
873
879
var decideResponse * iwfidl.WorkflowStateDecideResponse
874
880
881
+ stateExecuteApiStartTime := provider .Now (ctx ).UnixMilli ()
875
882
if ! provider .IsReplaying (ctx ) {
876
883
event .Handle (iwfidl.IwfEvent {
877
- EventType : iwfidl .STATE_EXECUTE_EE_START_EVENT ,
878
- WorkflowType : basicInfo .IwfWorkflowType ,
879
- WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
880
- WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
881
- StateId : ptr .Any (state .StateId ),
882
- StateExecutionId : ptr .Any (stateExeId ),
883
- SearchAttributes : persistenceManager .GetAllSearchAttributes (),
884
+ EventType : iwfidl .STATE_EXECUTE_EE_START_EVENT ,
885
+ WorkflowType : basicInfo .IwfWorkflowType ,
886
+ WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
887
+ WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
888
+ StateId : ptr .Any (state .StateId ),
889
+ StateExecutionId : ptr .Any (stateExeId ),
890
+ StartTimestampInMs : ptr .Any (stateExecuteApiStartTime ),
891
+ SearchAttributes : persistenceManager .GetAllSearchAttributes (),
884
892
})
885
893
}
886
- stateExecuteApiStartTime := provider .Now (ctx ).UnixMilli ()
887
894
err = provider .ExecuteActivity (& decideResponse , configer .ShouldOptimizeActivity (), ctx ,
888
895
executeApi , provider .GetBackendType (), service.StateDecideActivityInput {
889
896
IwfWorkerUrl : basicInfo .IwfWorkerUrl ,
@@ -913,13 +920,15 @@ func invokeStateExecute(
913
920
})
914
921
} else {
915
922
event .Handle (iwfidl.IwfEvent {
916
- EventType : iwfidl .STATE_EXECUTE_EE_FAIL_EVENT ,
917
- WorkflowType : basicInfo .IwfWorkflowType ,
918
- WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
919
- WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
920
- StateId : ptr .Any (state .StateId ),
921
- StateExecutionId : ptr .Any (stateExeId ),
922
- SearchAttributes : persistenceManager .GetAllSearchAttributes (),
923
+ EventType : iwfidl .STATE_EXECUTE_EE_FAIL_EVENT ,
924
+ WorkflowType : basicInfo .IwfWorkflowType ,
925
+ WorkflowId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .ID ,
926
+ WorkflowRunId : provider .GetWorkflowInfo (ctx ).WorkflowExecution .RunID ,
927
+ StateId : ptr .Any (state .StateId ),
928
+ StartTimestampInMs : ptr .Any (stateExecuteApiStartTime ),
929
+ EndTimestampInMs : ptr .Any (provider .Now (ctx ).UnixMilli ()),
930
+ StateExecutionId : ptr .Any (stateExeId ),
931
+ SearchAttributes : persistenceManager .GetAllSearchAttributes (),
923
932
})
924
933
}
925
934
}
0 commit comments