-
Notifications
You must be signed in to change notification settings - Fork 0
Debugging Worker Events
This page will describe the two primary methods of debugging events by using the yggctl
cli tool packaged with yggdrasil:
-
Dynamic observation using the
listen
command -
Static observation using the
message-journal
command.
Worker events can be tracked in a minimal text-based format by using the listen
command in the yggctl
cli tool to observe worker events as they are emitted.
Unlike using the message journal, this method streams worker events and does not provide options to filter events or display them in other formats.
$ yggctl listen --worker "<worker_name>"
> <worker-name>: <message-id>: <event>: <response-to-id>: <event-data>
$ touch ~/example.txt
$ yggctl listen --worker "<worker_name>" &> ~/example.txt
Worker events can be tracked by using the message-journal
command in the yggctl
cli tool.
The message journal displays a static list of events emitted by workers in multiple formats (table/text/json) and provides ways to filter the displayed worker events. This method also persistently stores worker events in a local database file to maintain records of emitted events across multiple yggdrasil sessions.
$ yggctl message-journal <opts>
Additional information about the usage and configuration of the message journal display can be found below.
The message journal can be enabled with yggd
by specifying a file path to create and store a message journal sqlite database.
$ yggd ... --message-journal ~/myjournal.db
The message journal can be interacted with using the yggctl
cli tool to
display the message journal with filters and formatting options applied.
$ yggctl message-journal
The message journal can be filtered in multiple ways when being displayed.
The current supported filtering operations are listed below:
The journal database stores worker events persistently between sessions.
By default the message journal will display events from only the active session, but using the --persistent
flag
will output worker events from the active session and all previous sessions.
$ yggctl message-journal --persistent
The journal can be filtered by a specific worker name using --worker
or
by a worker message id using --message-id
.
$ yggctl message-journal --worker "<name>"
$ yggctl message-journal --message-id "<id>"
The journal can be filtered to only display messages before/after/between UTC timestamps
with a combination of the --since
and --until
options.
The UTC timestamps use the YYYY-MM-DD HH:MM:SS
format.
$ yggctl message-journal --since "2024-01-01 00:00:00"
$ yggctl message-journal --until "2025-01-01 00:00:00"
$ yggctl message-journal --since "2024-01-01 00:00:00" --until "2025-01-01 00:00:00"
The message journal filtering options can be used together to create more useful journal outputs.
$ yggctl message-journal --worker "<name>" --message-id "<id>"
$ yggctl message-journal --worker "<name>" --since "2023-01-01 00:00:00" --until "2024-01-01 00:00:00"
The message journal can be displayed in the following formats:
- Table Formatting (Default)
- Text Formatting
- JSON Formatting
$ yggctl message-journal --format=table
MESSAGE # | MESSAGE ID | SENT | WORKER NAME | RESPONSE TO | WORKER EVENT | WORKER DATA
0 | <message-id> | <UTC timestamp> | <worker_name> | <response-to-id> | <event> | <data>
1 | ... | ... | ... | ... | ... | ...
$ yggctl message-journal --format=text
> <message-id> : <sent> : <UTC timestamp> : <worker_name> : <response-to-id> : <event> : <data>
> ...
$ yggctl message-journal --format=json
> [
{
"message-id": "<message-id>",
"response_to": "<response-to-id>",
"sent": "<UTC time>",
"worker_data": "<data>",
"worker_event": "<event>",
"worker_name": "<name>",
},
...
]
For additional usage information for message journal commands, please refer
to the --help
section of the message journal command using yggctl
.
$ yggctl message-journal --help