wgengine/magicsock: add metrics for sent disco messages
We only tracked the transport type (UDP vs DERP), not what they were.
@@ -1801,6 +1801,14 @@ func (c *Conn) sendDiscoMessage(dst netaddr.IPPort, dstKey key.NodePublic, dstDi
} else {
metricSentDiscoUDP.Add(1)
}
+ switch m.(type) {
+ case *disco.Ping:
+ metricSentDiscoPing.Add(1)
+ case *disco.Pong:
+ metricSentDiscoPong.Add(1)
+ case *disco.CallMeMaybe:
+ metricSentDiscoCallMeMaybe.Add(1)
+ }
} else if err == nil {
// Can't send. (e.g. no IPv6 locally)
} else {
@@ -4051,6 +4059,9 @@ func (di *discoInfo) setNodeKey(nk key.NodePublic) {
metricSendDiscoDERP = clientmetric.NewCounter("magicsock_disco_send_derp")
metricSentDiscoUDP = clientmetric.NewCounter("magicsock_disco_sent_udp")
metricSentDiscoDERP = clientmetric.NewCounter("magicsock_disco_sent_derp")
+ metricSentDiscoPing = clientmetric.NewCounter("magicsock_disco_sent_ping")
+ metricSentDiscoPong = clientmetric.NewCounter("magicsock_disco_sent_pong")
+ metricSentDiscoCallMeMaybe = clientmetric.NewCounter("magicsock_disco_sent_callmemaybe")
metricRecvDiscoBadPeer = clientmetric.NewCounter("magicsock_disco_recv_bad_peer")
metricRecvDiscoBadKey = clientmetric.NewCounter("magicsock_disco_recv_bad_key")
metricRecvDiscoBadParse = clientmetric.NewCounter("magicsock_disco_recv_bad_parse")
