temporalio / cli

Command-line interface for running Temporal Server and interacting with Workflows, Activities, Namespaces, and other parts of Temporal
https://docs.temporal.io/cli
MIT License
241 stars 32 forks source link

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

Open cretz opened 5 days ago

cretz commented 5 days ago

What was changed

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 #546
fairlydurable commented 5 days ago

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