Repository navigation
Add trace diffing (--diff) and streaming JSON output (--stream-json) - #81
Merged
Merged
Conversation
--diff before.json after.json compares two saved sessions hop by hop: path changes, added/lost hops, ECMP responder-set changes, avg RTT deltas (highlighted when >=5ms and >=20%), loss changes, and destination reachability. Combine with --json for machine-readable diff output. --stream-json emits each probe event (reply/timeout/late_reply) as one JSON line on stdout for piping to jq/grep/monitoring pipelines. Lines match the saved-session events schema with a target field added, and a per-target summary line closes the stream. Events are drained rather than indexed so memory stays bounded on infinite runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the full Trace Diffing & Streaming section of the roadmap as the v0.20 theme.
Trace diffing (
--diff before.json after.json)[path]markers for primary-responder changes,[added]/[lost]for hop presence, and+ip/-ipdetail lines for ECMP responder-set churn--diff ... --jsonemits the whole diff as machine-readable JSONStreaming JSON (
--stream-json)reply/timeout/late_reply), same schema as theeventsarray in saved session files plus atargetfield for demultiplexing multi-target runssummaryline per target (complete,dest_ttl,total_sent,hops_responding)--no-tui; conflicts with batch output flags; works with-cor until Ctrl-CImplementation notes
src/export/diff.rsandsrc/export/stream.rsfollow the existing export-module conventions (genericWritesinks, re-exported fromexport::)--diffearly-exits inmain()like--replay(no sockets, no permissions needed);load_sessionerror messages generalized from "replay file" to "session file"sanitize_displaybefore terminal outputTesting
cargo fmt --checkandcargo clippy --all-targets -- -D warningsclean--difftext + JSON output against generated fixtures (piped throughjq);--stream-jsonlive against localhost with finite-cruns, infinite runs ended via SIGINT (graceful summary emission), and jq filter composability