mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
control/controlclient: do not periodically print full netmap
The netmaps can get really large. Printing, processing, and uploading them is expensive. Only print the header on an ongoing basis. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
a666b546fb
commit
4c8b5fdec4
@ -872,15 +872,14 @@ func (c *Direct) sendMapRequest(ctx context.Context, maxPolls int, cb func(*netm
|
|||||||
nm.LocalPort = c.localPort
|
nm.LocalPort = c.localPort
|
||||||
c.mu.Unlock()
|
c.mu.Unlock()
|
||||||
|
|
||||||
// Printing the netmap can be extremely verbose, but is very
|
// Occasionally print the netmap header.
|
||||||
// handy for debugging. Let's limit how often we do it.
|
// This is handy for debugging, and our logs processing
|
||||||
// Code elsewhere prints netmap diffs every time, so this
|
// pipeline depends on it. (TODO: Remove this dependency.)
|
||||||
// occasional full dump, plus incremental diffs, should do
|
// Code elsewhere prints netmap diffs every time they are received.
|
||||||
// the job.
|
|
||||||
now := c.timeNow()
|
now := c.timeNow()
|
||||||
if now.Sub(c.lastPrintMap) >= 5*time.Minute {
|
if now.Sub(c.lastPrintMap) >= 5*time.Minute {
|
||||||
c.lastPrintMap = now
|
c.lastPrintMap = now
|
||||||
c.logf("[v1] new network map[%d]:\n%s", i, nm.Concise())
|
c.logf("[v1] new network map[%d]:\n%s", i, nm.VeryConcise())
|
||||||
}
|
}
|
||||||
|
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
|
@ -87,6 +87,12 @@ func (nm *NetworkMap) Concise() string {
|
|||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (nm *NetworkMap) VeryConcise() string {
|
||||||
|
buf := new(strings.Builder)
|
||||||
|
nm.printConciseHeader(buf)
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
|
||||||
// printConciseHeader prints a concise header line representing nm to buf.
|
// printConciseHeader prints a concise header line representing nm to buf.
|
||||||
//
|
//
|
||||||
// If this function is changed to access different fields of nm, keep
|
// If this function is changed to access different fields of nm, keep
|
||||||
@ -132,7 +138,7 @@ func (a *NetworkMap) equalConciseHeader(b *NetworkMap) bool {
|
|||||||
return (a.Debug == nil && b.Debug == nil) || reflect.DeepEqual(a.Debug, b.Debug)
|
return (a.Debug == nil && b.Debug == nil) || reflect.DeepEqual(a.Debug, b.Debug)
|
||||||
}
|
}
|
||||||
|
|
||||||
// printPeerConcise appends to buf a line repsenting the peer p.
|
// printPeerConcise appends to buf a line representing the peer p.
|
||||||
//
|
//
|
||||||
// If this function is changed to access different fields of p, keep
|
// If this function is changed to access different fields of p, keep
|
||||||
// in nodeConciseEqual in sync.
|
// in nodeConciseEqual in sync.
|
||||||
|
Loading…
Reference in New Issue
Block a user