ipn/ipnlocal,wgengine/magicsock: add basic counters for cached peer connectivity (#19699)
Add new clientmetric counters for establishing contact with peers while using cached network map data. To do this, instrument the magicsock.Conn with a bit to indicate whether its peer data came from a cached netmap. If so, there are two conditions we will count as establishing connectivity to a peer: - Receipt of a CallMeMaybe from a peer via disco. - Establishing a valid endpoint address for a peer. In vmtest, add Env.ClientMetrics to scrape metrics from the specified node. Use this to check that counters were updated in caching tests. Updates https://github.com/tailscale/projects/issues/13 Updates #12639 Change-Id: Ie8cf3244ac8af4f5bcfe4d0d944078da2ba08990 Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:
@@ -6587,7 +6587,11 @@ func (b *LocalBackend) setNetMapLocked(nm *netmap.NetworkMap) {
|
||||
b.currentNode().SetNetMap(nm)
|
||||
if ms, ok := b.sys.MagicSock.GetOK(); ok {
|
||||
if nm != nil {
|
||||
ms.SetNetworkMap(nm.SelfNode, nm.Peers)
|
||||
if nm.Cached {
|
||||
ms.SetNetworkMapCached(nm.SelfNode, nm.Peers)
|
||||
} else {
|
||||
ms.SetNetworkMap(nm.SelfNode, nm.Peers)
|
||||
}
|
||||
} else {
|
||||
ms.SetNetworkMap(tailcfg.NodeView{}, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user