Skip to content

Export Formats

The full report as a single JSON object — steps, events, and aggregate metrics:

_ = audit.ExportJSON("report.json")
// or:
_ = report.WriteJSON(os.Stdout)

Each event as a separate JSON line — ideal for streaming pipelines and log shippers:

_ = audit.ExportNDJSON("events.ndjson")
// or:
_ = report.WriteNDJSON(os.Stdout)

Export the step DAG with status-based coloring (succeeded = green, failed = red, skipped = gray, canceled = orange). Edges point dependency to step, following execution flow.

_ = audit.ExportMermaid("dag.mmd")
flowchart TD
fetch[fetch]
validate[validate]
save[save]
fetch --> validate
validate --> save
style fetch fill:#2d5a2d,color:#fff
style validate fill:#2d5a2d,color:#fff
style save fill:#2d5a2d,color:#fff
_ = audit.ExportGraphviz("dag.dot")
_ = audit.ExportD2("dag.d2")
_ = audit.ExportPlantUML("dag.puml")

All four diagram methods are also available as Write* (to io.Writer) and Write*String (returns string):

mmd, _ := report.WriteMermaidString()
dot, _ := report.WriteGraphvizString()

Step summary table with columns: Step, Status, Duration, Attempts, Error. Supports 16 formats via go-output:

import "github.com/larsartmann/go-output"
_ = audit.ExportTable("summary.csv", output.FormatCSV, output.RenderOptions{})
_ = audit.ExportTable("summary.md", output.FormatMarkdown, output.RenderOptions{})
_ = audit.ExportTable("summary.html", output.FormatHTML, output.RenderOptions{})

Available formats: table, json, csv, tsv, markdown, xml, yaml, html, jsonl, asciidoc, toml, plantuml.

_ = audit.ExportTree("tree.txt")
fetch
└── validate
└── transform
└── save
_ = audit.ExportHTMLTree("tree.html")

Nested <ul> list of the step DAG, suitable for embedding in web pages.

The report carries three duration fields. Always use wall_clock_duration_ms for user-facing summaries.

Field What it measures When it differs
total_duration_ms Sum of every step’s individual duration Inflated for parallel workflows — counts overlapping time multiple times.
wall_clock_duration_ms Actual elapsed time (earliest to latest event) The “how long did I wait?” number. Use this for summaries and Diff().
critical_path_duration_ms Longest dependency-chain duration (memoized DFS) The bottleneck path. If you can only parallelize one thing, this tells you which.
report := audit.Report()
fmt.Printf("Wall clock: %.0fms\n", report.WallClockDurationMs)
fmt.Printf("Critical path: %.0fms\n", report.CriticalPathDurationMs)
fmt.Println(report.Duration()) // delegates to wall-clock