Skip to content

[V2] Implement trace action#7151

Open
popojk wants to merge 5 commits intov2from
fix_trace_error
Open

[V2] Implement trace action#7151
popojk wants to merge 5 commits intov2from
fix_trace_error

Conversation

@popojk
Copy link
Copy Markdown
Contributor

@popojk popojk commented Apr 3, 2026

Tracking issue

n/a

Why are the changes needed?

Make trace action works

What changes were proposed in this pull request?

  1. Handle trace action in ActionService Enqueue API
  2. In InternalRunService RecordAction API, handle task and trace action separately
  3. Refactor RunService action repository CreateAction implementation
  4. Change the default sort field from id to created_at in action repository ListAction

How was this patch tested?

Labels

Please add one or more of the following labels to categorize your PR:

  • added: For new features.
  • changed: For changes in existing functionality.
  • deprecated: For soon-to-be-removed features.
  • removed: For features being removed.
  • fixed: For any bug fixed.
  • security: In case of vulnerabilities

This is important to improve the readability of release notes.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Signed-off-by: Alex Wu <c.alexwu@gmail.com>
@github-actions github-actions bot mentioned this pull request Apr 3, 2026
3 tasks
@popojk popojk marked this pull request as ready for review April 3, 2026 06:53
}

var actions []*models.Action
result := query.
Order("id ASC").
Order("created_at ASC").
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change the default sorting field to created_at because trace action use the start time generated in sdk runtime as created_at time and stored in db, and this change makes sure that the ordering is correct.

if token != "" {
query = query.Where("id > ?", token)
if t, err := time.Parse(time.RFC3339Nano, token); err == nil {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use created_at field to do pagination as it is the default sorting field

info := &workflow.RunInfo{
InputsUri: req.GetInputUri(),
}

logger.Infof(ctx, "RecordAction: action=%s parent=%s taskId=%v taskSpec=%v",
actionID.GetName(), req.GetParent(), req.GetTask().GetId(), req.GetTask().GetSpec() != nil)

switch v := req.GetSpec().(type) {
case *workflow.RecordActionRequest_Task:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor this piece of code to handle task action and trace action separately because the required field in db model is defferent

popojk added 2 commits April 3, 2026 15:09
Signed-off-by: Alex Wu <c.alexwu@gmail.com>
Signed-off-by: Alex Wu <c.alexwu@gmail.com>
popojk added 2 commits April 3, 2026 15:34
Signed-off-by: Alex Wu <c.alexwu@gmail.com>
Signed-off-by: Alex Wu <c.alexwu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants