Skip to content
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

op-node: Events diagrams generation #11101

Merged
merged 1 commit into from
Jul 12, 2024
Merged

op-node: Events diagrams generation #11101

merged 1 commit into from
Jul 12, 2024

Conversation

protolambda
Copy link
Contributor

@protolambda protolambda commented Jul 8, 2024

Description

This implements:

  • a struct-collecting event.Tracer, to gather data for diagram generation
  • a sequence-diagram generating tracer (based on mermaid js)
  • a timing-diagram generating tracer (custom SVG generation)

The outputs are .html files, with SVG content, ready to open in the browser.

PR depends on #11097

Example usage, in an action test:

	// add logging
	sequencer.eventSys.AddTracer(event.NewLogTracer(log, slog.LevelInfo))

	// add tracer, write at end of test
	seqTr := event.NewTimingTracer()
	sequencer.eventSys.AddTracer(seqTr)
	defer func() {
		require.NoError(t, os.WriteFile("custom_trace.html", []byte(seqTr.Output()), 0755))
		t.Log("written trace file")
	}()

Below diagrams visualize execution of TestEIP4844DataAvailability (action test)

Sequence diagram output example (incomplete screenshot, long scrolling page):

image

Timing diagram output example:

image

Tests

No tests, these are just nice-to-have debug tools.

Metadata

Fix #11098

@protolambda protolambda self-assigned this Jul 8, 2024
Base automatically changed from event-system to develop July 9, 2024 07:19
@tynes
Copy link
Contributor

tynes commented Jul 9, 2024

This is sick

@protolambda protolambda marked this pull request as ready for review July 10, 2024 19:40
@protolambda protolambda requested a review from ajsutton as a code owner July 10, 2024 19:40
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool.

Fun fact: the Chrome dev tools Performance tab lets you import timing profiles in a JSON format and you can then view the timeline similar to the SVG but with filtering, zoom etc. I was used it to capture build timing info I think and it was really awesome but sadly I can't find info on the file format it uses now.

@protolambda protolambda added this pull request to the merge queue Jul 12, 2024
Merged via the queue into develop with commit 6d48bac Jul 12, 2024
60 checks passed
@protolambda protolambda deleted the events-diagrams branch July 12, 2024 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Interop: event trace diagrams [nice to have]
3 participants