mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-19 17:37:32 +00:00
cmd/derpprobe,prober: add ability to perform continuous queuing delay measurements against DERP servers
This new type of probe sends DERP packets sized similarly to CallMeMaybe packets at a rate of 10 packets per second. It records the round-trip times in a Prometheus histogram. It also keeps track of how many packets are dropped. Packets that fail to arrive within 5 seconds are considered dropped. Updates tailscale/corp#24522 Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:

committed by
Percy Wegmann

parent
6ae0287a57
commit
00a4504cf1
29
prober/histogram_test.go
Normal file
29
prober/histogram_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package prober
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
func TestHistogram(t *testing.T) {
|
||||
h := newHistogram([]float64{1, 2})
|
||||
h.add(0.5)
|
||||
h.add(1)
|
||||
h.add(1.5)
|
||||
h.add(2)
|
||||
h.add(2.5)
|
||||
|
||||
if diff := cmp.Diff(h.count, uint64(5)); diff != "" {
|
||||
t.Errorf("wrong count; (-got+want):%v", diff)
|
||||
}
|
||||
if diff := cmp.Diff(h.sum, 7.5); diff != "" {
|
||||
t.Errorf("wrong sum; (-got+want):%v", diff)
|
||||
}
|
||||
if diff := cmp.Diff(h.bucketedCounts, map[float64]uint64{1: 2, 2: 2}); diff != "" {
|
||||
t.Errorf("wrong bucketedCounts; (-got+want):%v", diff)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user