Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: new thresholds for test command #3132

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cmd/testbeacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ type testBeaconConfig struct {
type testCaseBeacon func(context.Context, *testBeaconConfig, string) testResult

const (
thresholdBeaconPeersAvg = 20
thresholdBeaconPeersBad = 5
thresholdBeaconMeasureAvg = 40 * time.Millisecond
thresholdBeaconMeasureBad = 100 * time.Millisecond
thresholdBeaconPeersAvg = 50
thresholdBeaconPeersBad = 20
)

func newTestBeaconCmd(runFunc func(context.Context, io.Writer, testBeaconConfig) error) *cobra.Command {
Expand Down Expand Up @@ -256,9 +258,9 @@ func beaconPingMeasureTest(ctx context.Context, _ *testBeaconConfig, target stri
return failedTestResult(testRes, errors.New("status code %v", z.Int("status_code", resp.StatusCode)))
}

if firstByte > thresholdMeasureBad {
if firstByte > thresholdBeaconMeasureBad {
testRes.Verdict = testVerdictBad
} else if firstByte > thresholdMeasureAvg {
} else if firstByte > thresholdBeaconMeasureAvg {
testRes.Verdict = testVerdictAvg
} else {
testRes.Verdict = testVerdictGood
Expand Down
20 changes: 12 additions & 8 deletions cmd/testpeers.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ type testPeersConfig struct {
type testCasePeer func(context.Context, *testPeersConfig, host.Host, p2p.Peer) testResult

const (
thresholdMeasureAvg = 200 * time.Millisecond
thresholdMeasureBad = 500 * time.Millisecond
thresholdLoadAvg = 200 * time.Millisecond
thresholdLoadBad = 500 * time.Millisecond
thresholdMeasureAvg = 50 * time.Millisecond
thresholdMeasureBad = 240 * time.Millisecond
thresholdLoadAvg = 50 * time.Millisecond
thresholdLoadBad = 240 * time.Millisecond
thresholdPeersMeasureAvg = 50 * time.Millisecond
thresholdPeersMeasureBad = 240 * time.Millisecond
thresholdPeersLoadAvg = 50 * time.Millisecond
thresholdPeersLoadBad = 240 * time.Millisecond
)

func newTestPeersCmd(runFunc func(context.Context, io.Writer, testPeersConfig) error) *cobra.Command {
Expand Down Expand Up @@ -502,9 +506,9 @@ func peerPingMeasureTest(ctx context.Context, _ *testPeersConfig, tcpNode host.H
return failedTestResult(testRes, result.Error)
}

if result.RTT > thresholdMeasureBad {
if result.RTT > thresholdPeersMeasureBad {
testRes.Verdict = testVerdictBad
} else if result.RTT > thresholdMeasureAvg {
} else if result.RTT > thresholdPeersMeasureAvg {
testRes.Verdict = testVerdictAvg
} else {
testRes.Verdict = testVerdictGood
Expand Down Expand Up @@ -549,9 +553,9 @@ func peerPingLoadTest(ctx context.Context, conf *testPeersConfig, tcpNode host.H
highestRTT = val.RTT
}
}
if highestRTT > thresholdLoadBad {
if highestRTT > thresholdPeersLoadBad {
testRes.Verdict = testVerdictBad
} else if highestRTT > thresholdLoadAvg {
} else if highestRTT > thresholdPeersLoadAvg {
testRes.Verdict = testVerdictAvg
} else {
testRes.Verdict = testVerdictGood
Expand Down
Loading