checker: raise default RTT warning threshold to 200ms
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

The 100ms default warning collided with ordinary cross-region internet
latency (e.g. transatlantic RTTs of ~100ms), causing spurious warnings
on healthy long-haul targets. Bump the default warning to 200ms and
factor the warning/critical defaults into package constants so the two
call sites can no longer drift.
This commit is contained in:
nemunaire 2026-06-18 04:24:21 +09:00
commit fb1b1204b4

View file

@ -28,6 +28,14 @@ import (
sdk "git.happydns.org/checker-sdk-go/checker"
)
// Default RTT thresholds in milliseconds. These sit above ordinary
// cross-region internet latency (e.g. transatlantic RTTs of ~100ms) so
// that healthy long-haul targets do not trigger spurious warnings.
const (
defaultWarningRTT = 200.0
defaultCriticalRTT = 500.0
)
// rttRule evaluates the average round-trip time of each target against
// the configured warning/critical thresholds. Unreachable targets (no
// reply at all) are skipped; the reachability rule handles those.
@ -39,8 +47,8 @@ func (r *rttRule) Description() string {
}
func (r *rttRule) ValidateOptions(opts sdk.CheckerOptions) error {
warn := sdk.GetFloatOption(opts, "warningRTT", 100)
crit := sdk.GetFloatOption(opts, "criticalRTT", 500)
warn := sdk.GetFloatOption(opts, "warningRTT", defaultWarningRTT)
crit := sdk.GetFloatOption(opts, "criticalRTT", defaultCriticalRTT)
if warn <= 0 {
return fmt.Errorf("warningRTT must be positive")
}
@ -59,8 +67,8 @@ func (r *rttRule) Evaluate(ctx context.Context, obs sdk.ObservationGetter, opts
return []sdk.CheckState{noTargetsState("ping.rtt.no_targets")}
}
warn := sdk.GetFloatOption(opts, "warningRTT", 100)
crit := sdk.GetFloatOption(opts, "criticalRTT", 500)
warn := sdk.GetFloatOption(opts, "warningRTT", defaultWarningRTT)
crit := sdk.GetFloatOption(opts, "criticalRTT", defaultCriticalRTT)
out := make([]sdk.CheckState, 0, len(data.Targets))
for _, t := range data.Targets {