feat(batch): add json/csv output, max-loss exit code, and RTT jitter - #58
Merged
Merged
Conversation
- Add -o/--output (table, json, csv) for machine-readable batch results - Add --max-loss to exit with status 2 when any target exceeds the threshold - Add -I/--interface to batch for parity with interactive mode - Track RTT jitter (stddev, equivalent to ping's mdev) and show it in host details and json/csv output - Write progress to stderr only when it is a terminal and disable the failure beep in batch mode so stdout stays clean for pipes - Fix --count sending count+1 probes by stopping half an interval after the last round instead of racing the next tick Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Measure batch wait deadlines from a fixed start so sleep overshoot does not accumulate and exceed --count on long runs - Add shared.ValidateOutputFormat and use it from batch and WriteReport - Reuse WriteReport for the interactive mode's final table - Keep CSV header and row together via csvHeader/csvRecord, with a test - Add MetricsManager.SetBeepEnabled instead of check-and-toggle - Drop redundant cancel() and unreachable "" format case
9 of 11 tasks
servak
added a commit
that referenced
this pull request
Sep 24, 2026
feat(batch): add json/csv output, max-loss exit code, and RTT jitter
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
Make
mping batchusable from scripts, CI, and monitoring systems.-o/--output table|json|csv: machine-readable results. RTT fields are in milliseconds, timestamps are RFC3339, and zero timestamps are omitted.--max-loss PCT: exit with status2when any target's loss exceeds the threshold (violators are listed on stderr). Usage/config errors still exit1.mdevin iputils ping), shown in the TUI host detail panel and in json/csv output.\a) is disabled in batch mode.-I/--interfacefor batch, for parity with the interactive mode.Bug fix
--count Nused to send N+1 probes, because the wait (N*interval) raced the next ticker round. Batch now stops half an interval after the last round.Stop()already waits for in-flight probes, so the final replies are still collected.Test plan
go test ./...(added tests for jitter, json/csv export, max-loss boundaries, and flag validation)go test -raceon the changed packages--count 1/3/5→ exactly 1/3/5 sent;--max-loss 0→ exit 2; no BEL on stdout🤖 Generated with Claude Code