Skip to content

Conversation

lbarthon
Copy link

@lbarthon lbarthon commented Oct 1, 2025

The default verbosity level is 0, so the first part of this logic always evaluated to false, meaning that this would never be reached unless the user sets GRPC_GO_LOG_VERBOSITY_LEVEL=-1. This should be disabled by default.

This also swaps the and for an or, so that if channelz is off, the logic does not run either, which wasn't the case before.

This method has been using lots of CPU for some of our usecases, as serializing lots of addresseses repeatedly can be costly.

RELEASE NOTES:

  • resolver: change channelz log verbosity from 0 to 2

The default verbosity level is 0, so the first part of this logic always
evaluated to false, meaning that this would never be reached unless the user
sets `GRPC_GO_LOG_VERBOSITY_LEVEL=-1`. This should be disabled by default.

This also swaps the and for an or, so that if channelz is off, the logic does
not run either, which wasn't the case before.

This method has been using lots of CPU for some of our usecases, as serializing
lots of addresseses repeatedly can be costly.
Copy link

linux-foundation-easycla bot commented Oct 1, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: lbarthon / name: Louis (b60f4ab)

@lbarthon lbarthon closed this Oct 1, 2025
@lbarthon lbarthon reopened this Oct 1, 2025
@Pranjali-2501 Pranjali-2501 self-requested a review October 3, 2025 18:10
@easwars easwars added this to the 1.77 Release milestone Oct 6, 2025
// state received from resolver implementations.
func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) {
if !logger.V(0) && !channelz.IsOn() {
if !logger.V(2) || !channelz.IsOn() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want the verbosity check to affect whether or not channelz traces are being added. The channelz.Infof adds a log and a trace.

I would be OK with removing the verbosity check completely and only checking if channelz is turned on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I just read the PR description and noticed that there is a change from && to ||. Even with that change, I still think that totally getting rid of the verbosity check would be better, since it would retain existing behavior instead of changing it.

@easwars
Copy link
Contributor

easwars commented Oct 7, 2025

I also just noticed that you are concerned about CPU usage of this function. I think this was raised previously where we suggested that we could get rid of the pretty.JSON and replace it with something like %v or %+v. Or we could have resolver.State and all the structs that are referenced from it implement the Stringer interface so that we actually get useful data from these logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants