Skip to content

Commit

Permalink
IWF-105: Rename logevent > handleevent
Browse files Browse the repository at this point in the history
  • Loading branch information
lwolczynski committed Nov 18, 2024
1 parent 397e211 commit 78e3985
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
16 changes: 16 additions & 0 deletions service/common/handleevent/logevent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package handleevent

import "github.com/indeedeng/iwf/gen/iwfidl"

// The implementation must be lightweight, reliable and fast (less than 1s)
type HandleEventFunc func(event iwfidl.IwfEvent)

var Handler HandleEventFunc = DefaultHandleEventFunc

func SetHandleEventFunc(handler HandleEventFunc) {
Handler = handler
}

func DefaultHandleEventFunc(event iwfidl.IwfEvent) {
// Noop by default
}
16 changes: 0 additions & 16 deletions service/common/logevent/logevent.go

This file was deleted.

14 changes: 7 additions & 7 deletions service/interpreter/activityImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/indeedeng/iwf/gen/iwfidl"
"github.com/indeedeng/iwf/service"
"github.com/indeedeng/iwf/service/common/compatibility"
"github.com/indeedeng/iwf/service/common/logevent"
"github.com/indeedeng/iwf/service/common/handleevent"
"github.com/indeedeng/iwf/service/common/ptr"
"github.com/indeedeng/iwf/service/common/rpc"
"github.com/indeedeng/iwf/service/common/urlautofix"
Expand Down Expand Up @@ -54,7 +54,7 @@ func StateApiWaitUntil(
resp, httpResp, err := req.WorkflowStateStartRequest(input.Request).Execute()
printDebugMsg(logger, err, iwfWorkerBaseUrl)
if checkHttpError(err, httpResp) {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 57 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L57

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:57:15: undefined: handleevent.Log

Check failure on line 57 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L57

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:57:15: undefined: handleevent.Log

Check failure on line 57 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L57

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:57:15: undefined: handleevent.Log

Check failure on line 57 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L57

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:57:15: undefined: handleevent.Log
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand All @@ -66,7 +66,7 @@ func StateApiWaitUntil(
}

if err := checkCommandRequestFromWaitUntilResponse(resp); err != nil {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 69 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L69

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:69:15: undefined: handleevent.Log

Check failure on line 69 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L69

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:69:15: undefined: handleevent.Log

Check failure on line 69 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L69

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:69:15: undefined: handleevent.Log

Check failure on line 69 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L69

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:69:15: undefined: handleevent.Log
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand All @@ -82,7 +82,7 @@ func StateApiWaitUntil(
resp.LocalActivityInput = composeInputForDebug(input.Request.Context.GetStateExecutionId())
}

logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 85 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L85

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:85:14: undefined: handleevent.Log

Check failure on line 85 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L85

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:85:14: undefined: handleevent.Log

Check failure on line 85 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L85

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:85:14: undefined: handleevent.Log

Check failure on line 85 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L85

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:85:14: undefined: handleevent.Log
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_SUCC_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand Down Expand Up @@ -133,7 +133,7 @@ func StateApiExecute(
resp, httpResp, err := req.WorkflowStateDecideRequest(input.Request).Execute()
printDebugMsg(logger, err, iwfWorkerBaseUrl)
if checkHttpError(err, httpResp) {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 136 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L136

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:136:15: undefined: handleevent.Log

Check failure on line 136 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L136

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:136:15: undefined: handleevent.Log

Check failure on line 136 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L136

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:136:15: undefined: handleevent.Log

Check failure on line 136 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L136

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:136:15: undefined: handleevent.Log
EventType: iwfidl.STATE_EXECUTE_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand All @@ -147,7 +147,7 @@ func StateApiExecute(
}

if err = checkStateDecisionFromResponse(resp); err != nil {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 150 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L150

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:150:15: undefined: handleevent.Log

Check failure on line 150 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L150

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:150:15: undefined: handleevent.Log

Check failure on line 150 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L150

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:150:15: undefined: handleevent.Log

Check failure on line 150 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L150

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:150:15: undefined: handleevent.Log
EventType: iwfidl.STATE_EXECUTE_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand All @@ -165,7 +165,7 @@ func StateApiExecute(
resp.LocalActivityInput = composeInputForDebug(input.Request.Context.GetStateExecutionId())
}

logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 168 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L168

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:168:14: undefined: handleevent.Log

Check failure on line 168 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L168

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:168:14: undefined: handleevent.Log

Check failure on line 168 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L168

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:168:14: undefined: handleevent.Log

Check failure on line 168 in service/interpreter/activityImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/activityImpl.go#L168

undefined: handleevent.Log
Raw output
service/interpreter/activityImpl.go:168:14: undefined: handleevent.Log
EventType: iwfidl.STATE_EXECUTE_ATTEMPT_SUCC_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand Down
20 changes: 10 additions & 10 deletions service/interpreter/workflowImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
uclient "github.com/indeedeng/iwf/service/client"
"github.com/indeedeng/iwf/service/common/logevent"
"github.com/indeedeng/iwf/service/common/handleevent"
"github.com/indeedeng/iwf/service/common/ptr"
"github.com/indeedeng/iwf/service/common/utils"
"github.com/indeedeng/iwf/service/interpreter/env"
Expand All @@ -24,7 +24,7 @@ func InterpreterImpl(
if !provider.IsReplaying(ctx) {
// send metrics for the workflow result
if retErr == nil {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 27 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L27

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:27:17: undefined: handleevent.Log

Check failure on line 27 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L27

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:27:17: undefined: handleevent.Log

Check failure on line 27 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L27

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:27:17: undefined: handleevent.Log

Check failure on line 27 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L27

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:27:17: undefined: handleevent.Log
EventType: iwfidl.WORKFLOW_COMPLETE_EVENT,
WorkflowType: input.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand All @@ -33,7 +33,7 @@ func InterpreterImpl(
EndTimestampInMs: ptr.Any(provider.Now(ctx).UnixMilli()),
})
} else if provider.IsApplicationError(retErr) {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 36 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L36

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:36:17: undefined: handleevent.Log

Check failure on line 36 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L36

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:36:17: undefined: handleevent.Log

Check failure on line 36 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L36

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:36:17: undefined: handleevent.Log

Check failure on line 36 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L36

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:36:17: undefined: handleevent.Log
EventType: iwfidl.WORKFLOW_FAIL_EVENT,
WorkflowType: input.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand Down Expand Up @@ -147,7 +147,7 @@ func InterpreterImpl(

if !input.IsResumeFromContinueAsNew {
if !provider.IsReplaying(ctx) {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 150 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L150

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:150:16: undefined: handleevent.Log

Check failure on line 150 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L150

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:150:16: undefined: handleevent.Log

Check failure on line 150 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L150

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:150:16: undefined: handleevent.Log

Check failure on line 150 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L150

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:150:16: undefined: handleevent.Log
EventType: iwfidl.WORKFLOW_START_EVENT,
WorkflowType: input.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand Down Expand Up @@ -561,7 +561,7 @@ func processStateExecution(
doLoadingPolicy := compatibility.GetWaitUntilApiDataObjectsLoadingPolicy(state.StateOptions)

if !provider.IsReplaying(ctx) {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{

Check failure on line 564 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L564

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:564:16: undefined: handleevent.Log

Check failure on line 564 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L564

too many errors) (typecheck)
Raw output
service/interpreter/workflowImpl.go:564:16: too many errors) (typecheck)
	"github.com/indeedeng/iwf/service/interpreter"
	^

Check failure on line 564 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L564

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:564:16: undefined: handleevent.Log

Check failure on line 564 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L564

too many errors) (typecheck)
Raw output
service/interpreter/workflowImpl.go:564:16: too many errors) (typecheck)
	"github.com/indeedeng/iwf/service/interpreter"
	^

Check failure on line 564 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L564

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:564:16: undefined: handleevent.Log

Check failure on line 564 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L564

too many errors) (typecheck)
Raw output
service/interpreter/workflowImpl.go:564:16: too many errors) (typecheck)
	"github.com/indeedeng/iwf/service/interpreter"
	^

Check failure on line 564 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L564

undefined: handleevent.Log
Raw output
service/interpreter/workflowImpl.go:564:16: undefined: handleevent.Log

Check failure on line 564 in service/interpreter/workflowImpl.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] service/interpreter/workflowImpl.go#L564

too many errors (typecheck)
Raw output
service/interpreter/workflowImpl.go:564:16: too many errors (typecheck)
package interpreter
EventType: iwfidl.STATE_WAIT_UNTIL_EE_START_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand All @@ -583,14 +583,14 @@ func processStateExecution(
})
if !provider.IsReplaying(ctx) {
if errStartApi == nil {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(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 {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_EE_COMPLETE_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand Down Expand Up @@ -824,7 +824,7 @@ func invokeStateExecute(
var decideResponse *iwfidl.WorkflowStateDecideResponse

if !provider.IsReplaying(ctx) {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_EE_START_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand All @@ -850,7 +850,7 @@ func invokeStateExecute(
})
if !provider.IsReplaying(ctx) {
if err == nil {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_EE_COMPLETE_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand All @@ -861,7 +861,7 @@ func invokeStateExecute(
EndTimestampInMs: ptr.Any(provider.Now(ctx).UnixMilli()),
})
} else {
logevent.Log(iwfidl.IwfEvent{
handleevent.Log(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_EE_FAIL_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand Down

0 comments on commit 78e3985

Please sign in to comment.