Skip to content

Commit

Permalink
NOBUG: Fix emitted metrics (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwolczynski authored Nov 22, 2024
1 parent cd87220 commit 9739cc1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
22 changes: 14 additions & 8 deletions service/interpreter/activityImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ func StateApiWaitUntil(
printDebugMsg(logger, err, iwfWorkerBaseUrl)
if checkHttpError(err, httpResp) {
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
WorkflowRunId: activityInfo.WorkflowExecution.RunID,
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
WorkflowRunId: activityInfo.WorkflowExecution.RunID,
StateId: ptr.Any(input.Request.WorkflowStateId),
StateExecutionId: ptr.Any(input.Request.Context.GetStateExecutionId()),
})
return nil, composeHttpError(
activityInfo.IsLocalActivity,
Expand All @@ -67,10 +69,12 @@ func StateApiWaitUntil(

if err := checkCommandRequestFromWaitUntilResponse(resp); err != nil {
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
WorkflowRunId: activityInfo.WorkflowExecution.RunID,
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
WorkflowRunId: activityInfo.WorkflowExecution.RunID,
StateId: ptr.Any(input.Request.WorkflowStateId),
StateExecutionId: ptr.Any(input.Request.Context.GetStateExecutionId()),
})
return nil, composeStartApiRespError(provider, err, resp)
}
Expand All @@ -87,6 +91,8 @@ func StateApiWaitUntil(
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
WorkflowRunId: activityInfo.WorkflowExecution.RunID,
StateId: ptr.Any(input.Request.WorkflowStateId),
StateExecutionId: ptr.Any(input.Request.Context.GetStateExecutionId()),
StartTimestampInMs: ptr.Any(stateApiWaitUntilStartTime),
EndTimestampInMs: ptr.Any(time.Now().UnixMilli()),
})
Expand Down
28 changes: 17 additions & 11 deletions service/interpreter/workflowImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,12 @@ func processStateExecution(

if !provider.IsReplaying(ctx) {
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_EE_START_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
WorkflowRunId: provider.GetWorkflowInfo(ctx).WorkflowExecution.RunID,
EventType: iwfidl.STATE_WAIT_UNTIL_EE_START_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
WorkflowRunId: provider.GetWorkflowInfo(ctx).WorkflowExecution.RunID,
StateId: ptr.Any(state.StateId),
StateExecutionId: ptr.Any(stateExeId),
})
}
stateWaitUntilApiStartTime := provider.Now(ctx).UnixMilli()
Expand All @@ -583,21 +585,25 @@ func processStateExecution(
})
if !provider.IsReplaying(ctx) {
if errStartApi == nil {
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_EE_FAIL_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
WorkflowRunId: provider.GetWorkflowInfo(ctx).WorkflowExecution.RunID,
})
} else {
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_EE_COMPLETE_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
WorkflowRunId: provider.GetWorkflowInfo(ctx).WorkflowExecution.RunID,
StateId: ptr.Any(state.StateId),
StateExecutionId: ptr.Any(stateExeId),
StartTimestampInMs: ptr.Any(stateWaitUntilApiStartTime),
EndTimestampInMs: ptr.Any(provider.Now(ctx).UnixMilli()),
})
} else {
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_EE_FAIL_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
WorkflowRunId: provider.GetWorkflowInfo(ctx).WorkflowExecution.RunID,
StateId: ptr.Any(state.StateId),
StateExecutionId: ptr.Any(stateExeId),
})
}
}

Expand Down

0 comments on commit 9739cc1

Please sign in to comment.