|
|
@@ -136,7 +136,8 @@ type Server struct {
|
|
|
multiForwarderCreated expvar.Int
|
|
|
multiForwarderDeleted expvar.Int
|
|
|
removePktForwardOther expvar.Int
|
|
|
- avgQueueDuration *uint64 // In milliseconds; accessed atomically
|
|
|
+ avgQueueDuration *uint64 // In milliseconds; accessed atomically
|
|
|
+ tcpRtt metrics.LabelMap // histogram
|
|
|
|
|
|
// verifyClients only accepts client connections to the DERP server if the clientKey is a
|
|
|
// known peer in the network, as specified by a running tailscaled's client's local api.
|
|
|
@@ -312,6 +313,7 @@ func NewServer(privateKey key.NodePrivate, logf logger.Logf) *Server {
|
|
|
watchers: map[*sclient]bool{},
|
|
|
sentTo: map[key.NodePublic]map[key.NodePublic]int64{},
|
|
|
avgQueueDuration: new(uint64),
|
|
|
+ tcpRtt: metrics.LabelMap{Label: "le"},
|
|
|
keyOfAddr: map[netip.AddrPort]key.NodePublic{},
|
|
|
}
|
|
|
s.initMetacert()
|
|
|
@@ -713,6 +715,7 @@ func (c *sclient) run(ctx context.Context) error {
|
|
|
var grp errgroup.Group
|
|
|
sendCtx, cancelSender := context.WithCancel(ctx)
|
|
|
grp.Go(func() error { return c.sendLoop(sendCtx) })
|
|
|
+ grp.Go(func() error { return c.statsLoop(sendCtx) })
|
|
|
defer func() {
|
|
|
cancelSender()
|
|
|
if err := grp.Wait(); err != nil && !c.s.isClosed() {
|
|
|
@@ -1699,6 +1702,7 @@ func (s *Server) ExpVar() expvar.Var {
|
|
|
m.Set("average_queue_duration_ms", expvar.Func(func() any {
|
|
|
return math.Float64frombits(atomic.LoadUint64(s.avgQueueDuration))
|
|
|
}))
|
|
|
+ m.Set("counter_tcp_rtt", &s.tcpRtt)
|
|
|
var expvarVersion expvar.String
|
|
|
expvarVersion.Set(version.Long)
|
|
|
m.Set("version", &expvarVersion)
|