diff --git a/checker/rules_rtt.go b/checker/rules_rtt.go index a6be757..5ef851e 100644 --- a/checker/rules_rtt.go +++ b/checker/rules_rtt.go @@ -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 {