Skip to content

Commit 4fa27db

Browse files
authored
wgengine/magicsock: add clientmetrics for locally delivered Peer Relay alloc disco (tailscale#16833)
Expected when Peer Relay'ing via self. These disco messages never get sealed, and never leave the process. Updates tailscale/corp#30527 Signed-off-by: Jordan Whited <[email protected]>
1 parent 36397f1 commit 4fa27db

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wgengine/magicsock/magicsock.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ func (c *Conn) onUDPRelayAllocResp(allocResp UDPRelayAllocResp) {
681681
if selfNodeKey.Compare(allocResp.ReqRxFromNodeKey) == 0 &&
682682
allocResp.ReqRxFromDiscoKey.Compare(c.discoPublic) == 0 {
683683
c.relayManager.handleRxDiscoMsg(c, allocResp.Message, selfNodeKey, allocResp.ReqRxFromDiscoKey, epAddr{})
684+
metricLocalDiscoAllocUDPRelayEndpointResponse.Add(1)
684685
}
685686
return
686687
}
@@ -1926,6 +1927,7 @@ func (c *Conn) sendDiscoAllocateUDPRelayEndpointRequest(dst epAddr, dstKey key.N
19261927
RxFromDiscoKey: c.discoPublic,
19271928
Message: allocReq,
19281929
})
1930+
metricLocalDiscoAllocUDPRelayEndpointRequest.Add(1)
19291931
return true, nil
19301932
}
19311933
return c.sendDiscoMessage(dst, dstKey, dstDisco, allocReq, logLevel)
@@ -3990,6 +3992,7 @@ var (
39903992
metricSentDiscoBindUDPRelayEndpoint = clientmetric.NewCounter("magicsock_disco_sent_bind_udp_relay_endpoint")
39913993
metricSentDiscoBindUDPRelayEndpointAnswer = clientmetric.NewCounter("magicsock_disco_sent_bind_udp_relay_endpoint_answer")
39923994
metricSentDiscoAllocUDPRelayEndpointRequest = clientmetric.NewCounter("magicsock_disco_sent_alloc_udp_relay_endpoint_request")
3995+
metricLocalDiscoAllocUDPRelayEndpointRequest = clientmetric.NewCounter("magicsock_disco_local_alloc_udp_relay_endpoint_request")
39933996
metricSentDiscoAllocUDPRelayEndpointResponse = clientmetric.NewCounter("magicsock_disco_sent_alloc_udp_relay_endpoint_response")
39943997
metricRecvDiscoBadPeer = clientmetric.NewCounter("magicsock_disco_recv_bad_peer")
39953998
metricRecvDiscoBadKey = clientmetric.NewCounter("magicsock_disco_recv_bad_key")
@@ -4009,6 +4012,7 @@ var (
40094012
metricRecvDiscoAllocUDPRelayEndpointRequestBadDisco = clientmetric.NewCounter("magicsock_disco_recv_alloc_udp_relay_endpoint_request_bad_disco")
40104013
metricRecvDiscoAllocUDPRelayEndpointResponseBadDisco = clientmetric.NewCounter("magicsock_disco_recv_alloc_udp_relay_endpoint_response_bad_disco")
40114014
metricRecvDiscoAllocUDPRelayEndpointResponse = clientmetric.NewCounter("magicsock_disco_recv_alloc_udp_relay_endpoint_response")
4015+
metricLocalDiscoAllocUDPRelayEndpointResponse = clientmetric.NewCounter("magicsock_disco_local_alloc_udp_relay_endpoint_response")
40124016
metricRecvDiscoDERPPeerNotHere = clientmetric.NewCounter("magicsock_disco_recv_derp_peer_not_here")
40134017
metricRecvDiscoDERPPeerGoneUnknown = clientmetric.NewCounter("magicsock_disco_recv_derp_peer_gone_unknown")
40144018
// metricDERPHomeChange is how many times our DERP home region DI has

0 commit comments

Comments
 (0)