Skip to content

Commit a489f00

Browse files
committed
Improve readme
1 parent 7b7b41a commit a489f00

File tree

1 file changed

+65
-8
lines changed

1 file changed

+65
-8
lines changed

workflow-trace-viewer/README.md

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Workflow Trace Viewer
22

3-
A Compose for Desktop app that can be used to view Workflow traces.
3+
A Compose for Desktop application that visualizes and debugs Workflow execution traces. This tool
4+
helps developers understand the hierarchical structure and execution flow of their Workflow
5+
applications by providing both file-based and live streaming trace visualization.
46

57
## Running
68

@@ -10,20 +12,75 @@ It can be run via Gradle using:
1012
./gradlew :workflow-trace-viewer:run
1113
```
1214

13-
By Default, the app will be in file parsing mode, where you are able to select a previously recorded workflow trace file for it to visualize the data.
15+
## Usage Guide
1416

15-
By hitting the bottom switch, you are able to toggle to live stream mode, where data is directly pulled from the emulator into the visualizer. A connection can only happen once. If there needs to be rerecording of the trace, the emulator must first be restarted, and then the app must be restarted as well. This is due to the fact that any open socket will consume all render pass data, meaning there is nothing to read from the emulator.
17+
By default, the app will be in file parsing mode, where you are able to select a previously recorded
18+
workflow trace file for it to visualize the data. Once the workflow tree is rendered
19+
in [File](#file-mode) or [Live](#live-mode) mode, you can switch frames (
20+
see [Terminology](#Terminology)) to see different events that fired. All nodes are color coded based
21+
on what had happened during this frame, and a text diff will show the specific changes. You can open
22+
the right node panel and left click a box get a more detailed view of the specific node, or right
23+
click to expand/collapse a specific node's children.
1624

17-
It is ***important*** to run the emulator first before toggling to live mode.
25+
<img src="https://github.com/square/workflow-kotlin/raw/wenli/improve-visualizer/workflow-trace-viewer/docs/demo.gif" width="320" alt="Demo" />
26+
27+
#### File Mode
28+
29+
Once a file of the live data is saved, it can easily be uploaded to retrace the steps taken during
30+
the live session. Currently, text/json files that are saved from recordings only contain raw data,
31+
meaning it is simply a list of lists of node renderings.
32+
33+
<img src="https://github.com/square/workflow-kotlin/raw/wenli/improve-visualizer/workflow-trace-viewer/docs/file_mode.gif" width="320" alt="File Mode" />
34+
35+
#### Live Mode
36+
37+
By hitting the bottom switch, you are able to toggle to live stream mode, where data is directly
38+
pulled from the emulator into the visualizer. To do so:
39+
40+
1. Start the app (on any device)
41+
2. Start the app, and toggle the switch to enter Live mode
42+
3. Select the desired device
43+
44+
Once in Live mode, frames will appear as you interact with the app. You may also save the current
45+
data into a file saved in `~/Downloads` to be used later (this action will take some time, so it may
46+
not appear immediately)
47+
48+
Render pass data is passively stored in a buffer before being sent to the visualizer, so you do not
49+
need to immediately open/run the app to "catch" everything. However, since the the buffer has
50+
limited size, it's strongly recommended to avoid interacting with the app — beyond starting it —
51+
before Live mode has been triggered; this helps to avoid losing data.
52+
53+
<img src="https://github.com/square/workflow-kotlin/raw/wenli/improve-visualizer/workflow-trace-viewer/docs/live_mode.gif" width="320" alt="Live Mode" />
54+
55+
### Note
56+
57+
A connection can only happen once. There is currently no support for a recording of the trace data
58+
due to the fact that an open socket will consume all render pass data when a connection begins. To
59+
restart the recording:
60+
61+
1. (optional) Save the current trace
62+
2. Switch out of Live mode
63+
3. Restart the app
64+
4. Switch back to Live mode, and the
1865

1966
### Terminology
2067

21-
**Trace**: A trace is a file — made up of frames — that contains the execution history of a Workflow. It includes information about render passes, how states have changed within workflows, and the specific props being passed through. The data collected to generate these should be in chronological order, and allows developers to step through the process easily.
68+
`Trace`: A trace is a file — made up of frames — that contains the execution history of a Workflow.
69+
It includes information about render passes, how states have changed within workflows, and the
70+
specific props being passed through.
2271

23-
**Frame**: Essentially a "snapshot" of the current "state" of the whole Workflow tree. It contains relevant information about the changes in workflow states and how props are passed throughout.
72+
`Frame`: Essentially a "snapshot" of the current "state" of the whole Workflow tree. It contains
73+
relevant information about the changes in workflow states and how props are passed throughout.
2474

25-
- Note that "snapshot" and "state" are different from `snapshotState` and `State`, which are idiomatic to the Workflow library.
75+
- Note that "snapshot" and "state" are different from `snapshotState` and `State`, which are
76+
idiomatic to the Workflow library.
2677

2778
### External Libraries
2879

29-
[FileKit](https://github.com/vinceglb/FileKit) is an external library made to apply file operations on Kotlin and KMP projects. It's purpose in this app is to allow developers to upload their own json trace files. The motivation for its use is to quickly implement a file picker.
80+
[FileKit](https://github.com/vinceglb/FileKit) is an external library made to apply file operations
81+
on Kotlin and KMP projects. This simplified the development process of allowing file selection
82+
83+
## Future
84+
85+
This app can be integrated into the process of anyone working with Workflow, so it's highly
86+
encouraged for anyone to make improvements that makes their life a little easier using this app.

0 commit comments

Comments
 (0)