Skip to content

Commit

Permalink
fix: represent latency as empty string in csv printer failed probes (#…
Browse files Browse the repository at this point in the history
…276)

* fix: represent latency as empty string in csv printer failed probes

* Update csv.go

* Update csv.go

* Update csv.go
  • Loading branch information
SYSHIL authored Dec 25, 2024
1 parent 10c8639 commit e9d88d9
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ func (cp *csvPrinter) printStart(hostname string, port uint16) {

func (cp *csvPrinter) printProbeSuccess(localAddr string, userInput userInput, streak uint, rtt float32) {
hostname := userInput.hostname
if hostname == "" {
hostname = "-"
}

record := []string{
"Reply",
Expand All @@ -165,17 +162,18 @@ func (cp *csvPrinter) printProbeSuccess(localAddr string, userInput userInput, s

func (cp *csvPrinter) printProbeFail(userInput userInput, streak uint) {
hostname := userInput.hostname
if hostname == "" {
hostname = "-"
}

record := []string{
"No reply",
hostname,
userInput.ip.String(),
fmt.Sprint(userInput.port),
fmt.Sprint(streak),
"-",
"",
}

if *cp.showLocalAddress {
record = append(record, "")
}

if err := cp.writeRecord(record); err != nil {
Expand All @@ -187,10 +185,10 @@ func (cp *csvPrinter) printRetryingToResolve(hostname string) {
record := []string{
"Resolving",
hostname,
"-",
"-",
"-",
"-",
"",
"",
"",
"",
}

if err := cp.writeRecord(record); err != nil {
Expand All @@ -203,7 +201,7 @@ func (cp *csvPrinter) printError(format string, args ...any) {
}

func (cp *csvPrinter) writeStatsHeader() error {

headers := []string{
"Metric",
"Value",
Expand Down

0 comments on commit e9d88d9

Please sign in to comment.