@ -42,6 +42,7 @@ import (
"tailscale.com/net/portmapper"
"tailscale.com/net/portmapper"
"tailscale.com/net/sockstats"
"tailscale.com/net/sockstats"
"tailscale.com/net/stun"
"tailscale.com/net/stun"
"tailscale.com/net/tstun"
"tailscale.com/syncs"
"tailscale.com/syncs"
"tailscale.com/tailcfg"
"tailscale.com/tailcfg"
"tailscale.com/tstime"
"tailscale.com/tstime"
@ -2825,16 +2826,18 @@ var (
metricRecvDataIPv6 = clientmetric . NewCounter ( "magicsock_recv_data_ipv6" )
metricRecvDataIPv6 = clientmetric . NewCounter ( "magicsock_recv_data_ipv6" )
// Disco packets
// Disco packets
metricSendDiscoUDP = clientmetric . NewCounter ( "magicsock_disco_send_udp" )
metricSendDiscoUDP = clientmetric . NewCounter ( "magicsock_disco_send_udp" )
metricSendDiscoDERP = clientmetric . NewCounter ( "magicsock_disco_send_derp" )
metricSendDiscoDERP = clientmetric . NewCounter ( "magicsock_disco_send_derp" )
metricSentDiscoUDP = clientmetric . NewCounter ( "magicsock_disco_sent_udp" )
metricSentDiscoUDP = clientmetric . NewCounter ( "magicsock_disco_sent_udp" )
metricSentDiscoDERP = clientmetric . NewCounter ( "magicsock_disco_sent_derp" )
metricSentDiscoDERP = clientmetric . NewCounter ( "magicsock_disco_sent_derp" )
metricSentDiscoPing = clientmetric . NewCounter ( "magicsock_disco_sent_ping" )
metricSentDiscoPing = clientmetric . NewCounter ( "magicsock_disco_sent_ping" )
metricSentDiscoPong = clientmetric . NewCounter ( "magicsock_disco_sent_pong" )
metricSentDiscoPong = clientmetric . NewCounter ( "magicsock_disco_sent_pong" )
metricSentDiscoCallMeMaybe = clientmetric . NewCounter ( "magicsock_disco_sent_callmemaybe" )
metricSentDiscoPeerMTUProbes = clientmetric . NewCounter ( "magicsock_disco_sent_peer_mtu_probes" )
metricRecvDiscoBadPeer = clientmetric . NewCounter ( "magicsock_disco_recv_bad_peer" )
metricSentDiscoPeerMTUProbeBytes = clientmetric . NewCounter ( "magicsock_disco_sent_peer_mtu_probe_bytes" )
metricRecvDiscoBadKey = clientmetric . NewCounter ( "magicsock_disco_recv_bad_key" )
metricSentDiscoCallMeMaybe = clientmetric . NewCounter ( "magicsock_disco_sent_callmemaybe" )
metricRecvDiscoBadParse = clientmetric . NewCounter ( "magicsock_disco_recv_bad_parse" )
metricRecvDiscoBadPeer = clientmetric . NewCounter ( "magicsock_disco_recv_bad_peer" )
metricRecvDiscoBadKey = clientmetric . NewCounter ( "magicsock_disco_recv_bad_key" )
metricRecvDiscoBadParse = clientmetric . NewCounter ( "magicsock_disco_recv_bad_parse" )
metricRecvDiscoUDP = clientmetric . NewCounter ( "magicsock_disco_recv_udp" )
metricRecvDiscoUDP = clientmetric . NewCounter ( "magicsock_disco_recv_udp" )
metricRecvDiscoDERP = clientmetric . NewCounter ( "magicsock_disco_recv_derp" )
metricRecvDiscoDERP = clientmetric . NewCounter ( "magicsock_disco_recv_derp" )
@ -2852,4 +2855,18 @@ var (
// Disco packets received bpf read path
// Disco packets received bpf read path
metricRecvDiscoPacketIPv4 = clientmetric . NewCounter ( "magicsock_disco_recv_bpf_ipv4" )
metricRecvDiscoPacketIPv4 = clientmetric . NewCounter ( "magicsock_disco_recv_bpf_ipv4" )
metricRecvDiscoPacketIPv6 = clientmetric . NewCounter ( "magicsock_disco_recv_bpf_ipv6" )
metricRecvDiscoPacketIPv6 = clientmetric . NewCounter ( "magicsock_disco_recv_bpf_ipv6" )
// metricMaxPeerMTUProbed is the largest peer path MTU we successfully probed.
metricMaxPeerMTUProbed = clientmetric . NewGauge ( "magicsock_max_peer_mtu_probed" )
// metricRecvDiscoPeerMTUProbesByMTU collects the number of times we
// received an peer MTU probe response for a given MTU size.
// TODO: add proper support for label maps in clientmetrics
metricRecvDiscoPeerMTUProbesByMTU syncs . Map [ string , * clientmetric . Metric ]
)
)
func getPeerMTUsProbedMetric ( mtu tstun . WireMTU ) * clientmetric . Metric {
key := fmt . Sprintf ( "magicsock_recv_disco_peer_mtu_probes_by_mtu_%d" , mtu )
mm , _ := metricRecvDiscoPeerMTUProbesByMTU . LoadOrInit ( key , func ( ) * clientmetric . Metric { return clientmetric . NewCounter ( key ) } )
return mm
}