PcapFileEx.Flows.Summary.Render (pcap_file_ex v0.5.7)
View SourceRender Summary data as markdown tables and Mermaid flowcharts.
Markdown Tables
{:ok, result} = PcapFileEx.Flows.analyze("capture.pcapng")
markdown = PcapFileEx.Flows.Summary.Render.to_markdown(result.summary)
IO.puts(markdown)Mermaid Flowcharts
{:ok, result} = PcapFileEx.Flows.analyze("capture.pcapng")
mermaid = PcapFileEx.Flows.Summary.Render.to_mermaid(result.summary)
IO.puts(mermaid)
Summary
Functions
@spec to_markdown( PcapFileEx.Flows.Summary.t(), keyword() ) :: String.t()
Renders the summary as markdown tables.
Options
:title- Add section titles (default: true):humanize_bytes- Format bytes as KB/MB (default: false):protocol- Filter to :http1, :http2, :udp, or :all (default: :all)
Example
iex> render = PcapFileEx.Flows.Summary.Render.to_markdown(summary)
iex> IO.puts(render)
## HTTP Traffic
| Protocol | Server | Client | Requests | Responses | Req Bytes | Res Bytes | Avg RT (ms) |
...
@spec to_mermaid( PcapFileEx.Flows.Summary.t(), keyword() ) :: String.t()
Renders the summary as a Mermaid flowchart.
Options
:style- :host (default) or :service:host- Unified host nodes. Hosts that act as both client AND server appear as a single node. Protocol/port info on edges.:service- Each service (host:port) is a separate node, grouped by protocol with Clients subgraph.
:direction- :lr (left-right, default) or :tb (top-bottom):group_by- :protocol (default) or :none (only applies to :service style)
Example (default - unified host nodes)
iex> mermaid = PcapFileEx.Flows.Summary.Render.to_mermaid(summary)
iex> IO.puts(mermaid)
flowchart LR
web_client[web-client]
api_gateway[api-gateway]
web_client -->|"HTTP/2 :8080 (45 req)"| api_gatewayExample (style: :service - separate client/server nodes)
iex> mermaid = PcapFileEx.Flows.Summary.Render.to_mermaid(summary, style: :service)
iex> IO.puts(mermaid)
flowchart LR
subgraph Clients
c_web_client[web-client]
end
subgraph HTTP/2
shttp2_0[api-gateway:8080]
end
c_web_client -->|"45 req"| shttp2_0