Skip to content

Tracing LiveView diffs #793

@kraleppa

Description

@kraleppa

Provide an opt-in way to trace diffs produced by renders and inspect their sizes/content to help spot heavy updates

This task is result of #464

Scope / What to Build

  • Add a “Diffs” tab with:
    • List of diffs (timestamp, size, collapsible preview)
    • Toggle to enable/disable diff tracing (default OFF)
    • Optional simple bytes-over-time chart
  • Associate each produced diff with one or more render callbacks executed sequentially in the same LiveView process.
  • Show “Show Diff” links from callback traces when tracing is ON.
  • Handle special cases:
    • First render not traceable
    • Empty diffs (nil) skipped

Technical Notes

  • Use the PoC approach from PR PoC: performance debugging techniques #786: collect render events in a trace_handler (e.g., %{channel_pid => [render_callback_ids]}) until a diff is produced, then link them.
  • Keep tracing strictly scoped to the current LiveView; ensure minimal allocations when OFF.
  • Do not attempt low-level WebSocket/transport sizing in this task.

Acceptance Criteria

  • When tracing is ON, the Diffs tab populates entries with size and preview; OFF stops collection immediately.
  • “Show Diff” from a render callback opens a modal with the associated diff content.
  • First render is absent (by design); empty diffs are not listed.
  • Minimal overhead when OFF; acceptable overhead when ON (manual stress test).

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions