mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-30 18:41:49 -07:00
## What changed?
- Renames `tdbg workflow` to `tdbg execution` (maintaining 'workflow' and 'w' as aliases).
- Renames `tdbg execution describe --workflow-id` to `tdbg execution describe --business-id` (keeping 'wid' and 'workflow-id' as aliases)
- `tdbg execution describe` now dumps a CHASM tree's nodes, if one is present.
## Why?
- Prior to this, I'd have to first dump mutable state, then MANUALLY
parse out every field I cared about, manually look up its type, decode
it, unmarshal it, print it, ad infinitum..
Sample output for:
`./tdbg -n "features" e describe --business-id "lina-test" --archetype
"scheduler.scheduler"`:
```json
CHASM Tree Nodes:
{
"": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 1
},
"last_update_versioned_transition": {
"transition_count": 80
},
"Attributes": {
"ComponentAttributes": {
"type_id": 403648407
}
}
},
"decodedData": {
"schedule": {
"spec": {
"interval": [
{
"interval": "1s",
"phase": "0s"
}
]
},
"action": {
"startWorkflow": {
"workflowId": "lina-testwf",
"workflowType": {
"name": "BasicScheduleWorkflow"
},
"taskQueue": {
"name": " features-schedule",
"kind": "TASK_QUEUE_KIND_NORMAL"
}
}
},
"policies": {
"overlapPolicy": "SCHEDULE_OVERLAP_POLICY_SKIP",
"catchupWindow": "31536000s"
},
"state": {
"notes": "asdf"
}
},
"info": {
"actionCount": "2",
"overlapSkipped": "27",
"recentActions": [
{
"scheduleTime": "2025-12-22T20:04:45Z",
"actualTime": "2025-12-22T20:05:01.012942Z",
"startWorkflowResult": {
"workflowId": "lina-testwf-2025-12-22T20:04:45Z",
"runId": "019b47aa-49d1-792f-9c5c-2f876a6144d7"
},
"startWorkflowStatus": "WORKFLOW_EXECUTION_STATUS_FAILED"
},
{
"scheduleTime": "2025-12-22T20:06:55Z",
"actualTime": "2025-12-22T20:06:56.014349Z",
"startWorkflowResult": {
"workflowId": "lina-testwf-2025-12-22T20:06:55Z",
"runId": "019b47ac-0b0a-7d69-9fab-154ee95247cf"
},
"startWorkflowStatus": "WORKFLOW_EXECUTION_STATUS_FAILED"
}
],
"createTime": "2025-12-22T20:00:10.481808Z",
"updateTime": "2025-12-22T20:11:39.307879Z"
},
"namespace": "features",
"namespaceId": "ff4f1d27-b3b2-4030-a7ec-c309c00566a2",
"scheduleId": "lina-test",
"conflictToken": "22"
},
"nodeType": "component",
"componentFQN": "scheduler.scheduler"
},
"Backfillers": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 6
},
"last_update_versioned_transition": {
"transition_count": 6
},
"Attributes": {
"CollectionAttributes": {}
}
},
"rawData": {},
"nodeType": "collection"
},
"Backfillers#0f20cd1f-948b-4064-8275-409c2f06dba5": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 6
},
"last_update_versioned_transition": {
"transition_count": 6
},
"Attributes": {
"ComponentAttributes": {
"type_id": 571775395
}
}
},
"decodedData": {
"triggerRequest": {
"scheduledTime": "2025-12-22T20:00:38.650636Z"
},
"backfillId": "0f20cd1f-948b-4064-8275-409c2f06dba5",
"lastProcessedTime": "2025-12-22T20:00:38.651414Z"
},
"nodeType": "component",
"componentFQN": "scheduler.backfiller"
},
"Backfillers#15b9dcc6-1575-4ada-a77b-42672d720287": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 9
},
"last_update_versioned_transition": {
"transition_count": 9
},
"Attributes": {
"ComponentAttributes": {
"type_id": 571775395
}
}
},
"decodedData": {
"triggerRequest": {
"scheduledTime": "2025-12-22T20:02:18.389188Z"
},
"backfillId": "15b9dcc6-1575-4ada-a77b-42672d720287",
"lastProcessedTime": "2025-12-22T20:02:18.390459Z"
},
"nodeType": "component",
"componentFQN": "scheduler.backfiller"
},
"Backfillers#78bd223c-7818-4d92-a318-6c1cde0e17b3": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 7
},
"last_update_versioned_transition": {
"transition_count": 7
},
"Attributes": {
"ComponentAttributes": {
"type_id": 571775395
}
}
},
"decodedData": {
"triggerRequest": {
"scheduledTime": "2025-12-22T20:00:59.368696Z"
},
"backfillId": "78bd223c-7818-4d92-a318-6c1cde0e17b3",
"lastProcessedTime": "2025-12-22T20:00:59.369805Z"
},
"nodeType": "component",
"componentFQN": "scheduler.backfiller"
},
"Backfillers#f0c472b5-1cc2-4a50-ab1b-e14fe593eaa5": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 77
},
"last_update_versioned_transition": {
"transition_count": 77
},
"Attributes": {
"ComponentAttributes": {
"type_id": 571775395
}
}
},
"decodedData": {
"triggerRequest": {
"scheduledTime": "2025-12-22T20:11:12.469511Z"
},
"backfillId": "f0c472b5-1cc2-4a50-ab1b-e14fe593eaa5",
"lastProcessedTime": "2025-12-22T20:11:12.470441Z"
},
"nodeType": "component",
"componentFQN": "scheduler.backfiller"
},
"Generator": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 1
},
"last_update_versioned_transition": {
"transition_count": 78
},
"Attributes": {
"ComponentAttributes": {
"type_id": 545946520
}
}
},
"decodedData": {
"lastProcessedTime": "2025-12-22T20:07:10.003099Z",
"futureActionTimes": [
"2025-12-22T20:07:15Z",
"2025-12-22T20:07:20Z",
"2025-12-22T20:07:25Z",
"2025-12-22T20:07:30Z",
"2025-12-22T20:07:35Z",
"2025-12-22T20:07:40Z",
"2025-12-22T20:07:45Z",
"2025-12-22T20:07:50Z",
"2025-12-22T20:07:55Z",
"2025-12-22T20:08:00Z"
]
},
"nodeType": "component",
"componentFQN": "scheduler.generator"
},
"Invoker": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 1
},
"last_update_versioned_transition": {
"transition_count": 70
},
"Attributes": {
"ComponentAttributes": {
"type_id": 2628858954
}
}
},
"decodedData": {
"lastProcessedTime": "2025-12-22T20:07:06.004086Z",
"requestIdToWorkflowId": {
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433890000-1766433890000": "lina-testwf-2025-12-22T20:04:50Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433895000-1766433895000": "lina-testwf-2025-12-22T20:04:55Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433900000-1766433900000": "lina-testwf-2025-12-22T20:05:00Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433905000-1766433905000": "lina-testwf-2025-12-22T20:05:05Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433910000-1766433910000": "lina-testwf-2025-12-22T20:05:10Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433915000-1766433915000": "lina-testwf-2025-12-22T20:05:15Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433920000-1766433920000": "lina-testwf-2025-12-22T20:05:20Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433925000-1766433925000": "lina-testwf-2025-12-22T20:05:25Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433930000-1766433930000": "lina-testwf-2025-12-22T20:05:30Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433935000-1766433935000": "lina-testwf-2025-12-22T20:05:35Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433940000-1766433940000": "lina-testwf-2025-12-22T20:05:40Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433945000-1766433945000": "lina-testwf-2025-12-22T20:05:45Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433950000-1766433950000": "lina-testwf-2025-12-22T20:05:50Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433955000-1766433955000": "lina-testwf-2025-12-22T20:05:55Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433960000-1766433960000": "lina-testwf-2025-12-22T20:06:00Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433965000-1766433965000": "lina-testwf-2025-12-22T20:06:05Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433970000-1766433970000": "lina-testwf-2025-12-22T20:06:10Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433975000-1766433975000": "lina-testwf-2025-12-22T20:06:15Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433980000-1766433980000": "lina-testwf-2025-12-22T20:06:20Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433985000-1766433985000": "lina-testwf-2025-12-22T20:06:25Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433990000-1766433990000": "lina-testwf-2025-12-22T20:06:30Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766433995000-1766433995000": "lina-testwf-2025-12-22T20:06:35Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766434000000-1766434000000": "lina-testwf-2025-12-22T20:06:40Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766434005000-1766434005000": "lina-testwf-2025-12-22T20:06:45Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766434010000-1766434010000": "lina-testwf-2025-12-22T20:06:50Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766434020000-1766434020000": "lina-testwf-2025-12-22T20:07:00Z",
"sched-auto-ff4f1d27-b3b2-4030-a7ec-c309c00566a2-lina-test-11-1766434025000-1766434025000": "lina-testwf-2025-12-22T20:07:05Z"
}
},
"nodeType": "component",
"componentFQN": "scheduler.invoker"
},
"LastCompletionResult": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 70
},
"last_update_versioned_transition": {
"transition_count": 70
},
"Attributes": {
"DataAttributes": {}
}
},
"rawData": {
"encoding_type": 1,
"data": "EhgKFG9wZXJhdGlvbiB0ZXJtaW5hdGVkQgA="
},
"nodeType": "data"
},
"Visibility": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 1
},
"last_update_versioned_transition": {
"transition_count": 80
},
"Attributes": {
"ComponentAttributes": {
"type_id": 2662156547,
"side_effect_tasks": [
{
"type_id": 4193112626,
"scheduled_time": {
"seconds": -62135596800
},
"data": {
"encoding_type": 1,
"data": "CDU="
},
"versioned_transition": {
"transition_count": 80
},
"versioned_transition_offset": 1,
"physical_task_status": 1
}
]
}
}
},
"rawData": {
"encoding_type": 1,
"data": "CDU="
},
"nodeType": "component (stateless)",
"componentFQN": "core.vis",
"sideEffectTasks": [
{
"typeId": 4193112626,
"taskFQN": "core.visTask",
"scheduledTime": "0001-01-01T00:00:00Z",
"decodedData": {
"transitionCount": "53"
},
"versionedTransition": {
"transition_count": 80
},
"physicalTaskStatus": 1
}
]
},
"Visibility$Memo": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 1
},
"last_update_versioned_transition": {
"transition_count": 1
},
"Attributes": {
"DataAttributes": {}
}
},
"rawData": {
"encoding_type": 1
},
"nodeType": "data"
},
"Visibility$SA": {
"metadata": {
"initial_versioned_transition": {
"transition_count": 1
},
"last_update_versioned_transition": {
"transition_count": 1
},
"Attributes": {
"DataAttributes": {}
}
},
"rawData": {
"encoding_type": 1
},
"nodeType": "data"
}
}
Execution Info:
{
"namespaceId": "ff4f1d27-b3b2-4030-a7ec-c309c00566a2",
"workflowId": "lina-test",
"lastRunningClock": "1049018",
"startTime": "2025-12-22T20:00:10.477729Z",
"lastUpdateTime": "2025-12-22T20:11:39.308118Z",
"workflowTaskTimeout": "0s",
"workflowTaskAttempt": 1,
"workflowTaskRequestId": "emptyUuid",
"autoResetPoints": {},
"versionHistories": {
"histories": [
{}
]
},
"executionStats": {},
"stateTransitionCount": "80",
"executionTime": "2025-12-22T20:00:10.477729Z",
"transitionHistory": [
{
"transitionCount": "80"
}
],
"taskGenerationShardClockTimestamp": "1048731",
"visibilityLastUpdateVersionedTransition": {
"transitionCount": "1"
},
"subStateMachineTombstoneBatches": [
{
"versionedTransition": {
"transitionCount": "1"
},
"stateMachineTombstones": [
{
"chasmNodePath": "Backfillers"
}
]
}
]
}
```
## How did you test it?
- [x] built
- [x] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
43 lines
945 B
Go
43 lines
945 B
Go
package chasm
|
|
|
|
import (
|
|
"context"
|
|
"reflect"
|
|
)
|
|
|
|
func (r *Registry) Component(fqn string) (*RegistrableComponent, bool) {
|
|
return r.component(fqn)
|
|
}
|
|
|
|
func (r *Registry) Task(fqn string) (*RegistrableTask, bool) {
|
|
return r.task(fqn)
|
|
}
|
|
|
|
func (r *Registry) ComponentFor(componentInstance any) (*RegistrableComponent, bool) {
|
|
return r.componentFor(componentInstance)
|
|
}
|
|
|
|
func (r *Registry) ComponentOf(componentGoType reflect.Type) (*RegistrableComponent, bool) {
|
|
return r.componentOf(componentGoType)
|
|
}
|
|
|
|
func (r *Registry) TaskFor(taskInstance any) (*RegistrableTask, bool) {
|
|
return r.taskFor(taskInstance)
|
|
}
|
|
|
|
func (r *Registry) TaskOf(taskGoType reflect.Type) (*RegistrableTask, bool) {
|
|
return r.taskOf(taskGoType)
|
|
}
|
|
|
|
func (rc RegistrableComponent) FqType() string {
|
|
return rc.fqType()
|
|
}
|
|
|
|
func (rt RegistrableTask) FqType() string {
|
|
return rt.fqType()
|
|
}
|
|
|
|
func EngineFromContext(ctx context.Context) Engine {
|
|
return engineFromContext(ctx)
|
|
}
|