Documentation
¶
Overview ¶
Package csvexport writes pingtrace results to disk as CSV.
Filenames follow {op}[_TAG]_UTC<YYYY-MM-DD-HH-MM-SS>.csv. When the run is scoped to one or more CIDRs the TAG is the sanitized CIDR list (e.g. ping_10.0.0.0_28_UTC...csv); otherwise the TAG segment is omitted. One file is produced per operation per run; subsequent targets / cycles append rows to the same file.
Index ¶
- type FileInfo
- type Writer
- func (w *Writer) Close() ([]string, error)
- func (w *Writer) Files() []FileInfo
- func (w *Writer) MTRCycle(target string, cycle int, snap probe.MTRResult) error
- func (w *Writer) Ping(target string, r probe.PingResult) error
- func (w *Writer) PingSummary(target string, r probe.PingResult) error
- func (w *Writer) SetCompact(v bool)
- func (w *Writer) SetFromTo(src, to string)
- func (w *Writer) SetTag(tag string)
- func (w *Writer) Trace(target string, r probe.TraceResult) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer holds one or more open CSV files for the lifetime of a run. All public methods are safe for concurrent use; an internal mutex serializes writes so the bulk-mode worker pool can call us from many goroutines without corrupting rows.
func New ¶
New creates the export directory (if missing) and stamps every filename written through this Writer with the same UTC timestamp.
func (*Writer) Close ¶
Close flushes and closes every file opened by this writer and returns the list of paths produced (for the final summary line).
func (*Writer) Files ¶
Files returns a snapshot of the files opened so far, along with how many data rows have been written to each (excluding the header). Safe to call after Close to feed `jsonreport.Writer`'s exportedFiles.
func (*Writer) Ping ¶
func (w *Writer) Ping(target string, r probe.PingResult) error
Ping writes per-packet rows for one target.
func (*Writer) PingSummary ¶
func (w *Writer) PingSummary(target string, r probe.PingResult) error
PingSummary writes one summary row per target instead of per-packet.
func (*Writer) SetCompact ¶ added in v1.1.0
SetCompact enables compact mode: columns that are entirely empty across all rows of a target are omitted from the CSV output. The column set is locked in on the first write to each file and held for all subsequent targets in the same run.
func (*Writer) SetFromTo ¶ added in v1.1.0
SetFromTo sets the source IP and target description used in filenames. When both are non-empty the filename becomes:
<op>_from_<src>_to_<to>_UTC<stamp>.csv
Call before the first write.