@@ -54,8 +54,8 @@ import (
54
54
"tailscale.com/types/netmap"
55
55
"tailscale.com/types/nettype"
56
56
"tailscale.com/util/clientmetric"
57
- "tailscale.com/util/netconv"
58
57
"tailscale.com/util/mak"
58
+ "tailscale.com/util/netconv"
59
59
"tailscale.com/util/uniq"
60
60
"tailscale.com/version"
61
61
"tailscale.com/wgengine/monitor"
@@ -603,6 +603,7 @@ func (c *Conn) stopPeriodicReSTUNTimerLocked() {
603
603
604
604
// c.mu must NOT be held.
605
605
func (c * Conn ) updateEndpoints (why string ) {
606
+ metricUpdateEndpoints .Add (1 )
606
607
defer func () {
607
608
c .mu .Lock ()
608
609
defer c .mu .Unlock ()
@@ -1048,7 +1049,7 @@ func (c *Conn) determineEndpoints(ctx context.Context) ([]tailcfg.Endpoint, erro
1048
1049
}
1049
1050
1050
1051
var already map [netaddr.IPPort ]tailcfg.EndpointType // endpoint -> how it was found
1051
- var eps []tailcfg.Endpoint // unique endpoints
1052
+ var eps []tailcfg.Endpoint // unique endpoints
1052
1053
1053
1054
ipp := func (s string ) (ipp netaddr.IPPort ) {
1054
1055
ipp , _ = netaddr .ParseIPPort (s )
@@ -2768,6 +2769,7 @@ func (c *Conn) ReSTUN(why string) {
2768
2769
// raced with a shutdown.
2769
2770
return
2770
2771
}
2772
+ metricReSTUNCalls .Add (1 )
2771
2773
2772
2774
// If the user stopped the app, stop doing work. (When the
2773
2775
// user stops Tailscale via the GUI apps, ipn/local.go
@@ -2917,6 +2919,7 @@ func (c *Conn) rebind(curPortFate currentPortFate) error {
2917
2919
// Rebind closes and re-binds the UDP sockets and resets the DERP connection.
2918
2920
// It should be followed by a call to ReSTUN.
2919
2921
func (c * Conn ) Rebind () {
2922
+ metricRebindCalls .Add (1 )
2920
2923
if err := c .rebind (keepCurrentPort ); err != nil {
2921
2924
c .logf ("%w" , err )
2922
2925
return
@@ -4138,6 +4141,10 @@ var (
4138
4141
metricNumPeers = clientmetric .NewGauge ("magicsock_netmap_num_peers" )
4139
4142
metricNumDERPConns = clientmetric .NewGauge ("magicsock_num_derp_conns" )
4140
4143
4144
+ metricRebindCalls = clientmetric .NewCounter ("magicsock_rebind_calls" )
4145
+ metricReSTUNCalls = clientmetric .NewCounter ("magicsock_restun_calls" )
4146
+ metricUpdateEndpoints = clientmetric .NewCounter ("magicsock_update_endpoints" )
4147
+
4141
4148
// Sends (data or disco)
4142
4149
metricSendDERPQueued = clientmetric .NewCounter ("magicsock_send_derp_queued" )
4143
4150
metricSendDERPErrorChan = clientmetric .NewCounter ("magicsock_send_derp_error_chan" )
0 commit comments