-
Notifications
You must be signed in to change notification settings - Fork 231
feat: event and workflow run metadata #446
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
feat: event and workflow run metadata #446
Conversation
…-in-the-events-view
…-in-the-events-view
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
internal/repository/event.go
Outdated
@@ -48,6 +51,9 @@ type ListEventOpts struct { | |||
|
|||
// (optional) the order direction | |||
OrderDirection *string `validate:"omitempty, DESC"` | |||
|
|||
// (optional) the event metadata | |||
AdditionalMetadata *[]byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AdditionalMetadata *[]byte | |
AdditionalMetadata []byte |
Arrays are nil by default, so *
is unnecessary
internal/repository/workflow_run.go
Outdated
@@ -231,6 +253,9 @@ type ListWorkflowRunsOpts struct { | |||
|
|||
// (optional) the order direction | |||
OrderDirection *string `validate:"omitempty, DESC"` | |||
|
|||
// (optional) exact metadata to filter by | |||
AdditionalMetadata *map[string]interface{} `validate:"omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AdditionalMetadata *map[string]interface{} `validate:"omitempty"` | |
AdditionalMetadata map[string]interface{} `validate:"omitempty"` |
internal/repository/workflow_run.go
Outdated
@@ -248,6 +273,9 @@ type WorkflowRunsMetricsOpts struct { | |||
|
|||
// (optional) the event id that triggered the workflow run | |||
EventId *string `validate:"omitempty,uuid"` | |||
|
|||
// (optional) exact metadata to filter by | |||
AdditionalMetadata *map[string]interface{} `validate:"omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AdditionalMetadata *map[string]interface{} `validate:"omitempty"` | |
AdditionalMetadata map[string]interface{} `validate:"omitempty"` |
return ec.processEvent(ctx, metadata.TenantId, payload.EventId, payload.EventKey, []byte(payload.EventData)) | ||
additionalMetadata := make(map[string]interface{}) | ||
|
||
err = json.Unmarshal([]byte(payload.EventAdditionalMetadata), &additionalMetadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need nil check
@@ -0,0 +1,12 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collapse into 1 migration
@@ -17,6 +17,8 @@ import ( | |||
) | |||
|
|||
func (t *WorkflowService) WorkflowRunCreate(ctx echo.Context, request gen.WorkflowRunCreateRequestObject) (gen.WorkflowRunCreateResponseObject, error) { | |||
// TODO metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove todo?
@@ -57,8 +59,26 @@ func (t *WorkflowService) WorkflowRunCreate(ctx echo.Context, request gen.Workfl | |||
), nil | |||
} | |||
|
|||
createOpts, err := repository.GetCreateWorkflowRunOptsFromManual(workflowVersion, inputBytes) | |||
additionalMetadata := make(map[string]interface{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionalMetadata := make(map[string]interface{}) | |
var additionalMetadata map[string]interface{} |
…-in-the-events-view
Description
Often arbitrary metadata tags or labels are desirable to organize events and workflow runs.
Type of change
What's Changed
References: hatchet-dev/hatchet-typescript#86