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

Supported flattened event detail view on workflow show/execute #615

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

cretz
Copy link
Member

@cretz cretz commented Jul 3, 2024

What was changed

  • Removed --event-details from workflow show and workflow execute that, in text mode, blindly dumped full event in table column in an unreadable way
    • 💥 BREAKING CHANGE
  • Added --detailed to workflow show and workflow execute that, for text output, dumps events as sections
    • Live streaming (i.e. --follow for workflow show) still supported

Before with something like temporal workflow show -w my-wf --event-details:

Progress:
  ID           Time                     Type                   Details
    1  2024-07-03T16:48:06Z  WorkflowExecutionStarted    {"workflowType":{"name":"DevWorkflow"}, "taskQueue":{"name":"54937496-3012-40f1-8803-667c93c99ac5", "kind":"TASK_QUEUE_KIND_NORMAL"}, "input":{"payloads":[{"metadata":{"encoding":"anNvbi9wbGFpbg=="}, "data":"Imlnbm9yZWQi"}]}, "workflowExecutionTimeout":"0s", "workflowRunTimeout":"0s", "workflowTaskTimeout":"10s", "originalExecutionRunId":"ed8999e4-7cb9-44ad-8fac-40724c9a9a58", "identity":"cli-test-client", "firstExecutionRunId":"ed8999e4-7cb9-44ad-8fac-40724c9a9a58", "attempt":1, "firstWorkflowTaskBackoff":"0s", "header":{}, "workflowId":"15cda007-b4b2-40cc-9b6f-6cd06e1ac4e6"}
    2  2024-07-03T16:48:06Z  WorkflowTaskScheduled       {"taskQueue":{"name":"54937496-3012-40f1-8803-667c93c99ac5", "kind":"TASK_QUEUE_KIND_NORMAL"}, "startToCloseTimeout":"10s", "attempt":1}
    3  2024-07-03T16:48:06Z  WorkflowExecutionSignaled   {"signalName":"my-signal", "input":{"payloads":[{"metadata":{"encoding":"YmluYXJ5L251bGw="}}]}, "identity":"cli-test-client", "header":{}}
    4  2024-07-03T16:48:06Z  WorkflowExecutionSignaled   {"signalName":"my-signal", "input":{"payloads":[{"metadata":{"encoding":"YmluYXJ5L251bGw="}}]}, "identity":"cli-test-client", "header":{}}
    5  2024-07-03T16:48:06Z  WorkflowTaskStarted         {"scheduledEventId":"2", "identity":"cli-test-client", "requestId":"7ed83f01-5598-40b2-9e18-f92e9111d3b5", "historySizeBytes":"520", "workerVersion":{"buildId":"178aaa53a048affa90c8eb23330cc70e"}}
    6  2024-07-03T16:48:06Z  WorkflowTaskCompleted       {"scheduledEventId":"2", "startedEventId":"5", "identity":"cli-test-client", "workerVersion":{"buildId":"178aaa53a048affa90c8eb23330cc70e"}, "sdkMetadata":{"langUsedFlags":[3], "sdkName":"temporal-go", "sdkVersion":"1.27.0"}, "meteringMetadata":{}}
    7  2024-07-03T16:48:06Z  WorkflowExecutionCompleted  {"result":{"payloads":[{"metadata":{"encoding":"anNvbi9wbGFpbg=="}, "data":"ImhpISI="}]}, "workflowTaskCompletedEventId":"6"}

Results:
  Status          COMPLETED
  Result          "hi!"
  ResultEncoding  json/plain

(note how bad this would be wrapping in a terminal)

After with something like temporal workflow show -w my-wf --detailed:

Progress:
--------------- [1] WorkflowExecutionStarted ---------------
attempt: 1
eventTime: 2024-07-03T16:50:18.601465300Z
firstExecutionRunId: 93aed421-dd11-47a7-88d3-fcabfd80cf06
firstWorkflowTaskBackoff: 0s
identity: cli-test-client
input[0]: ignored
originalExecutionRunId: 93aed421-dd11-47a7-88d3-fcabfd80cf06
taskId: 1048592
taskQueue.kind: TASK_QUEUE_KIND_NORMAL
taskQueue.name: d598a582-102c-4ece-b33b-0b4993c623b4
workflowExecutionTimeout: 0s
workflowId: ce7c1d27-e7d2-4ec0-ae37-03baa805d002
workflowRunTimeout: 0s
workflowTaskTimeout: 10s
workflowType.name: DevWorkflow

--------------- [2] WorkflowTaskScheduled ---------------
attempt: 1
eventTime: 2024-07-03T16:50:18.601465300Z
startToCloseTimeout: 10s
taskId: 1048593
taskQueue.kind: TASK_QUEUE_KIND_NORMAL
taskQueue.name: d598a582-102c-4ece-b33b-0b4993c623b4

--------------- [3] WorkflowExecutionSignaled ---------------
eventTime: 2024-07-03T16:50:18.601971400Z
identity: cli-test-client
input[0].metadata.encoding: YmluYXJ5L251bGw=
signalName: my-signal
taskId: 1048598

--------------- [4] WorkflowExecutionSignaled ---------------
eventTime: 2024-07-03T16:50:18.603642500Z
identity: cli-test-client
input[0].metadata.encoding: YmluYXJ5L251bGw=
signalName: my-signal
taskId: 1048600

--------------- [5] WorkflowTaskStarted ---------------
eventTime: 2024-07-03T16:50:18.603642500Z
historySizeBytes: 520
identity: cli-test-client
requestId: c511d110-c37a-4198-b7bd-e35c1953fcd9
scheduledEventId: 2
taskId: 1048602
workerVersion.buildId: e534651359743d27d180ef44397135ef

--------------- [6] WorkflowTaskCompleted ---------------
eventTime: 2024-07-03T16:50:18.603642500Z
identity: cli-test-client
scheduledEventId: 2
sdkMetadata.langUsedFlags[0]: 3
sdkMetadata.sdkName: temporal-go
sdkMetadata.sdkVersion: 1.27.0
startedEventId: 5
taskId: 1048606
workerVersion.buildId: e534651359743d27d180ef44397135ef

--------------- [7] WorkflowExecutionCompleted ---------------
eventTime: 2024-07-03T16:50:18.603642500Z
result[0]: hi!
taskId: 1048607
workflowTaskCompletedEventId: 6

Results:
  Status          COMPLETED
  Result          "hi!"
  ResultEncoding  json/plain

Note, the table form still exists for non --detailed. Also note that we can continually tweak this post-merge, don't need to block merge for little pieces.

Checklist

  1. Closes [Feature Request] Make workflow show Details more readable #546

@cretz cretz requested a review from a team July 3, 2024 16:58
@cretz cretz marked this pull request as ready for review July 3, 2024 17:02
Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

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

Yay, this is so much better

Comment on lines +307 to +309
} else {
s.Contains(output, "WorkflowExecutionSignaled")
}
Copy link
Member

Choose a reason for hiding this comment

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

This would show up in both output kinds, right? Non-detailed on the line, and detailed in the section header.

Copy link
Member Author

@cretz cretz Jul 3, 2024

Choose a reason for hiding this comment

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

Yes, but before this the test tested nothing about non-detailed event output, so I just thought I'd add it in an else for code clarity reasons (I can do better assertions on detailed). But I can move it out of else.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I'd just assert it either way

Comment on lines +526 to +527
sort.Slice(fields, func(i, j int) bool { return fields[i].field < fields[j].field })
return fields, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

For arrays, will sorting do alphabetical sort as opposed to numerical "7" > "10"

Copy link
Member Author

Choose a reason for hiding this comment

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

It might, good catch! I will fix this and add a test for it.

Copy link
Contributor

@antlai-temporal antlai-temporal left a comment

Choose a reason for hiding this comment

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

This looks great, so much cleaner than before

@fairlydurable
Copy link
Contributor

Once stabilized, maybe add it to the new help to promote it?

@cretz cretz merged commit fad6810 into temporalio:main Jul 12, 2024
7 checks passed
@cretz cretz deleted the workflow-show-details branch July 12, 2024 16:54
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.

[Feature Request] Make workflow show Details more readable
4 participants