Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Commit

Permalink
Use microseconds for rtt everywhere instead of milliseconds. Currentl…
Browse files Browse the repository at this point in the history
…y we calculate in microseconds and export in milliseconds, this is confusing and unnecessary.

ORIGINAL_AUTHOR=Manu Garg <[email protected]>
PiperOrigin-RevId: 162277410
  • Loading branch information
manugarg committed Jul 17, 2017
1 parent f6a475c commit fa62d61
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 35 deletions.
10 changes: 1 addition & 9 deletions probes/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ package dns
import (
"context"
"errors"
"fmt"
"net"
"sync"
"time"
Expand Down Expand Up @@ -83,16 +82,9 @@ type probeRunResult struct {
}

func newProbeRunResult(target string) probeRunResult {
prr := probeRunResult{
return probeRunResult{
target: target,
}
// Borgmon and friends expect results to be in milliseconds. We should
// change expectations at the Borgmon end once the transition to the new
// metrics model is complete.
prr.rtt.Str = func(i int64) string {
return fmt.Sprintf("%.3f", float64(i)/1000)
}
return prr
}

// Metrics converts probeRunResult into metrics.EventMetrics object
Expand Down
9 changes: 1 addition & 8 deletions probes/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,11 @@ type probeRunResult struct {
}

func newProbeRunResult(target string) probeRunResult {
prr := probeRunResult{
return probeRunResult{
target: target,
respCodes: metrics.NewMap("code", &metrics.Int{}),
respBodies: metrics.NewMap("resp", &metrics.Int{}),
}
// Borgmon and friends expect results to be in milliseconds. We should
// change expectations at the Borgmon end once the transition to the new
// metrics model is complete.
prr.rtt.Str = func(i int64) string {
return fmt.Sprintf("%.3f", float64(i)/1000)
}
return prr
}

// Metrics converts probeRunResult into a slice of the metrics that is suitable for
Expand Down
2 changes: 1 addition & 1 deletion probes/ping/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func (p *Probe) Start(ctx context.Context, dataChan chan *metrics.EventMetrics)
em := metrics.NewEventMetrics(ts).
AddMetric("sent", metrics.NewInt(p.sent[t])).
AddMetric("rcvd", metrics.NewInt(p.received[t])).
AddMetric("rtt", metrics.NewInt(p.latencyUsec[t]/1000)).
AddMetric("rtt", metrics.NewInt(p.latencyUsec[t])).
AddLabel("ptype", "ping").
AddLabel("probe", p.name).
AddLabel("dst", t)
Expand Down
9 changes: 1 addition & 8 deletions probes/udp/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,9 @@ type probeRunResult struct {
}

func newProbeRunResult(target string) probeRunResult {
prr := probeRunResult{
return probeRunResult{
target: target,
}
// Borgmon and friends expect results to be in milliseconds. We should
// change expectations at the Borgmon end once the transition to the new
// metrics model is complete.
prr.rtt.Str = func(i int64) string {
return fmt.Sprintf("%.3f", float64(i)/1000)
}
return prr
}

// Target returns the p.target.
Expand Down
10 changes: 1 addition & 9 deletions utils/proberesults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package utils

import (
"context"
"fmt"
"testing"
"time"

Expand All @@ -36,16 +35,9 @@ type probeRunResult struct {
}

func newProbeRunResult(target string) probeRunResult {
prr := probeRunResult{
return probeRunResult{
target: target,
}
// Borgmon and friends expect results to be in milliseconds. We should
// change expectations at the Borgmon end once the transition to the new
// metrics model is complete.
prr.rtt.Str = func(i int64) string {
return fmt.Sprintf("%.3f", float64(i)/1000)
}
return prr
}

// Metrics converts probeRunResult into a map of the metrics that is suitable for
Expand Down

0 comments on commit fa62d61

Please sign in to comment.