Skip to content

xDS server spams mode "switches" #4939

@ejona86

Description

@ejona86

When trying to debug a (non-Go) problem, I was looking at logs and discovered that Go xDS server is very spammy.

Per A36 xDS for Servers:

If the application does not register the callback, XdsServer should log any errors and each serving resumption after an error, all at a default-visible log level.

Go appears to be broken in multiple ways:

  1. The logs occur even if the application provides a callback
  2. The logs occur even for transitions from SERVING to SERVING. The only time the default logger should log in SERVING state is if immediately previously there was an error state

func (l *listenerWrapper) switchMode(fcs *xdsclient.FilterChainManager, newMode connectivity.ServingMode, err error) {
l.mu.Lock()
defer l.mu.Unlock()
l.filterChains = fcs
l.mode = newMode
if l.modeCallback != nil {
l.modeCallback(l.Listener.Addr(), newMode, err)
}
l.logger.Warningf("Listener %q entering mode: %q due to error: %v", l.Addr(), newMode, err)
}

This is much more mild, but for a reason that I don't understand, the xds interop test server is providing its own callback. That seems unnecessary given the default behavior. But it will log up to two times per event:

func xdsServingModeCallback(addr net.Addr, args xds.ServingModeChangeArgs) {
logger.Infof("Serving mode for xDS server at %s changed to %s", addr.String(), args.Mode)
if args.Err != nil {
logger.Infof("ServingModeCallback returned error: %v", args.Err)
}
}

It would be more clear as a single log entry.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions