Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOBUG: Fix emitted metrics #489

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading