-
Notifications
You must be signed in to change notification settings - Fork 212
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
feat(swingset): slogfile visualization: PlantUML, causeway (WIP) #3624
base: master
Are you sure you want to change the base?
Conversation
The slog-to-diagram script on this branch does an alternative rendering. For example, see the sequence diagram for #3760 |
While working with @Chris-Hibbert on governance, I find myself wishing for this Causeway integration often. Just after @erights asked if something similar to recent work on the XS console (#3856) could be used to get stack traces in the REPL, I found myself looking at a rather un-helpful Today I talked with @warner about adding message sequence numbers in kernel delivery objects to facilitate correlating send syscalls with deliveries (and resolve syscalls with notifications). (cf. #6501) We puzzled over FF-workers.log some, along with mainBuyer.js but didn't reach a full understanding. I didn't manage to work Causeway's Trace Log Format docs into the discussion. Setting this aside again, for now... |
33b99c4
to
a923083
Compare
progress! Some causal links aren't quite hooked up right, but lots of stuff is working: notes to self:
|
797ced8
to
31edf64
Compare
represent promise resolution just like message deliveryAfter more study of examples, I realized they don't use anything fancy to represent promise resolution. Just Now it all seems to work pretty well. vatAdmin device is a bit magicThe |
A couple examples are working pretty well:
The @@ error dialog is safe to ignore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Causeway is an interesting tool. It would be nice to be able to make use of it. Some questions from glancing at the code....
|
||
import './types.js'; | ||
|
||
const { freeze } = Object; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is freeze
different from harden
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
freeze
is part of the JS standard library. I was avoiding dependencies on the Agoric platform while building this tool.
Substantively: freeze isn't recursive.
const { freeze } = Object; | ||
|
||
/** | ||
* @typedef { | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does @typedef { | Something }
mean?
oh, it's only used on line 17, so it expands to
@typedef {
org.ref_send.log.
org.ref_send.log.Something
} LogClassT
Should the first entry end in a bare dot? Nope, from the def'n on line 20, it looks like the empty case shouldn't be included. Does @typedef
drop it, or is this a mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The leading |
in @typedef { | Something }
is a little like the trailing ,
in const x = [1,2,3,]
. It's ignored.
But line breaking rules in typescript-in-jsdoc are weird, and the declaration breaks without it.
class: [LogClass.Got, LogClass.Event], | ||
anchor, | ||
message, | ||
trace: { calls: [{ name: text, source: '@@' }] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does '@@'
do? It looks like you expect the source location to be substituted, but I couldn't find any JS doc saying that's the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'@@'
means "I don't have a source file name, but the causeway code ignores this whole node unless it has something here, so I'll stick some arbitrary marker for now."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps '<unknown-source>'
. I’ve used this pattern elsewhere to improve error messages like JSON parse errors for a file with a name that defaults to '<unknown-something>'
.
@arirubinstein for reference, https://github.com/Agoric/agoric-sdk/blob/slog-to-causeway/packages/SwingSet/misc-tools/slog-to-diagram.mjs is the tool that I used to make that .puml sequence diagram out of bootstrap and starting the RUN protocol. Usage is as in the to generate the input slog file, use |
- reserve only appropriate names in agoricNames name hubs
- install gov contracts - test that boot-psm puts an instance in agoricNames
for PSM-only config
- sort by time - number by elapsed time within a block
- show promise resolution state - add @startuml , @enduml
- handle lack of block time markers, e.g. in testing
- make some fields optional - use SentIf / condition for promise resolution problem: conflicting Sent for message Rkp41, Rkp42 two resolve syscalls with the same deliveryNum
this provokes causeway to show stuff
- don't add { text} on .Got so that vat,turn is shown - add ko, kp, body.length detail to .Send
- log about unknonwn tags - handle / skip missing dInfo / dr[2] - handle / skip negative t
- a bit more static typing
inter-vat message visualization service@toliaqat as discussed, it would be nice to wrap this half-baked code (or anything that does a similar job) as a service of sorts:
slog.svg is an example I generated today. Makefile shows how I did it. It belongs in agoric-sdk/packages/SwingSet/misc-tools$ make
yq -p csv -o json -I=0 '.[] | .Message' extract-2024-08-23T16_12_20.185Z.csv | tac | \
jq -c 'select((.time >= 1724425557.382605 - 2) and (.time <= 1724425559.071834))' >requested-interval.slog
node slog-to-diagram.mjs <requested-interval.slog >requested-interval.puml
syscall tag unknown: vatstoreGet
syscall tag unknown: subscribe
syscall tag unknown: vatstoreSet
type unknown: console
type unknown: notify
syscall tag unknown: vatstoreDelete
syscall tag unknown: vatstoreGetNextKey
syscall tag unknown: invoke
??? t < 0 0
no source for { ref: 'Rkp13858960' }
# https://plantuml.com/command-line
java -jar plantuml-1.2022.7.jar -tsvg requested-interval.puml
agoric-sdk/packages/SwingSet/misc-tools$ ls -ltr extract-2024-08-23T16_12_20.185Z.csv requested-interval.* *.svg
-rw-rw-r-- 1 connolly connolly 21276242 Aug 23 11:12 extract-2024-08-23T16_12_20.185Z.csv
-rw-rw-r-- 1 connolly connolly 1311000 Aug 23 15:58 requested-interval.slog
-rw-rw-r-- 1 connolly connolly 3990 Aug 23 15:58 requested-interval.puml
-rw-rw-r-- 1 connolly connolly 49601 Aug 23 15:58 slog.svg The Option: diagram keyThe participants in the state diagram are vats. Arrows represent messages between vats. A solid arrow labelled: 0.1 kp13858945 <- ko1009519.fromBridge(866) That means: at 0.1 seconds into the block, a message with method An arrow with An arrow whose tail is the left edge of the diagram means the script couldn't figure out which vat it came from. (Some messages come from the kernel.) Yellow boxes indicate large computron counts. Option: vat key@warner has some tools that make vat maps:
Option: slog file inputThe user might have a slogfile rather than a datadog extract. Option: start with offer idThe precipitating event in this case was proposing a DebtLimit change. Like all smart contract interactions, the relevant transaction has an OfferSpec including an id. The user could provide the id, and the service would find where that id shows up in datadog logs and extract from there for the following 10 or 20 seconds. Option: start with any search stringMaybe the search term doesn't have to be an offer id. It could be a distinctive error message, or whatever. Option: start with time intervalPerhaps the user knows the relevant time interval. |
@warner , @erights ,
This runs to completion in the case of
chain-1.slog.gz
that I got from @warner , but causeway complains about the output:I ran
zcat chain-1.slog.gz | node slog-to-causeway.mjs >chain1.log
and putchain-1.log
in (my checked out copy) of https://github.com/cocoonfx/causeway/tree/master/src/js/com/teleometry/causeway/purchase_example/workers/logThen I made this tweak to point at it:
and then visited
causalityGrid.html
in a vs-code live server.cc @kriskowal @michaelfig @FUDCo @katelynsills