ipnlocal/drive: reduce noisey per-peer remote logs (#19493)

This drops the per peer "appending remote" log while constructing the remote list, which can get noisy on big tailnets, and keeps logs around remote availability checks, including whether a peer is missing, offline, lacks PeerAPI reachability, lacks sharing permission, or is available.

Updates tailscale/corp#40580

Signed-off-by: kari-ts <kari@tailscale.com>
This commit is contained in:
kari-ts
2026-04-24 08:26:33 -07:00
committed by GitHub
parent ad9e6c1925
commit aa740cb393
+12 -12
View File
@@ -303,18 +303,19 @@ func (b *LocalBackend) updateDrivePeersLocked(nm *netmap.NetworkMap) {
} }
func (b *LocalBackend) driveRemotesFromPeers(nm *netmap.NetworkMap) []*drive.Remote { func (b *LocalBackend) driveRemotesFromPeers(nm *netmap.NetworkMap) []*drive.Remote {
b.logf("[v1] taildrive: setting up drive remotes from peers") b.logf("[v1] taildrive: setting up drive remotes from %d peers", len(nm.Peers))
driveRemotes := make([]*drive.Remote, 0, len(nm.Peers)) driveRemotes := make([]*drive.Remote, 0, len(nm.Peers))
for _, p := range nm.Peers { for _, p := range nm.Peers {
peer := p peer := p
peerID := peer.ID() peerID := peer.ID()
peerKey := peer.Key().ShortString() peerKey := peer.Key().ShortString()
b.logf("[v1] taildrive: appending remote for peer %s", peerKey) peerName := peer.DisplayName(false)
driveRemotes = append(driveRemotes, &drive.Remote{ driveRemotes = append(driveRemotes, &drive.Remote{
Name: p.DisplayName(false), Name: peerName,
URL: func() string { URL: func() string {
url := fmt.Sprintf("%s/%s", b.currentNode().PeerAPIBase(peer), taildrivePrefix[1:]) url := fmt.Sprintf("%s/%s", b.currentNode().PeerAPIBase(peer), taildrivePrefix[1:])
b.logf("[v2] taildrive: url for peer %s: %s", peerKey, url) b.logf("[v2] taildrive: url for peer %s (%s): %s", peerKey, peerName, url)
return url return url
}, },
Available: func() bool { Available: func() bool {
@@ -325,7 +326,7 @@ func (b *LocalBackend) driveRemotesFromPeers(nm *netmap.NetworkMap) []*drive.Rem
cn := b.currentNode() cn := b.currentNode()
peer, ok := cn.NodeByID(peerID) peer, ok := cn.NodeByID(peerID)
if !ok { if !ok {
b.logf("[v2] taildrive: Available(): peer %s not found", peerKey) b.logf("[v2] taildrive: peer %s (%s, id=%v) not found", peerKey, peerName, peerID)
return false return false
} }
@@ -338,26 +339,25 @@ func (b *LocalBackend) driveRemotesFromPeers(nm *netmap.NetworkMap) []*drive.Rem
// The netmap.Peers slice is not updated in all cases. // The netmap.Peers slice is not updated in all cases.
// It should be fixed now that we use PeerByIDOk. // It should be fixed now that we use PeerByIDOk.
if !peer.Online().Get() { if !peer.Online().Get() {
b.logf("[v2] taildrive: Available(): peer %s offline", peerKey) b.logf("[v2] taildrive: peer %s (%s, id=%v) offline", peerKey, peerName, peerID)
return false return false
} }
if cn.PeerAPIBase(peer) == "" {
if b.currentNode().PeerAPIBase(peer) == "" { b.logf("[v2] taildrive: peer %s (%s, id=%v) PeerAPI unreachable", peerKey, peerName, peerID)
b.logf("[v2] taildrive: Available(): peer %s PeerAPI unreachable", peerKey)
return false return false
} }
// Check that the peer is allowed to share with us. // Check that the peer is allowed to share with us.
if cn.PeerHasCap(peer, tailcfg.PeerCapabilityTaildriveSharer) { if cn.PeerHasCap(peer, tailcfg.PeerCapabilityTaildriveSharer) {
b.logf("[v2] taildrive: Available(): peer %s available", peerKey) b.logf("[v2] taildrive: peer %s (%s, id=%v) available", peerKey, peerName, peerID)
return true return true
} }
b.logf("[v2] taildrive: Available(): peer %s not allowed to share", peerKey) b.logf("[v2] taildrive: peer %s (%s, id=%v) not allowed to share", peerKey, peerName, peerID)
return false return false
}, },
}) })
} }
b.logf("[v1] taildrive: built %d candidate remotes", len(driveRemotes))
return driveRemotes return driveRemotes
} }