Skip to content

avoid unnecessary logging field creation when payload logging is disabled - #809

Merged
johanbrandhorst merged 2 commits into
grpc-ecosystem:mainfrom
dbeneker:main
Nov 1, 2025
Merged

avoid unnecessary logging field creation when payload logging is disabled#809
johanbrandhorst merged 2 commits into
grpc-ecosystem:mainfrom
dbeneker:main

Conversation

@dbeneker

Copy link
Copy Markdown
Contributor

While debugging a performance-critical gRPC stream, I noticed that the logging reporter creates logging fields for every sent and received message, even when the LoggableEvent options PayloadReceived and PayloadSent are not set.
This unnecessary field creation increases garbage collection pressure and negatively impacts throughput.

Changes

Added an early return in the PostMsgSend() and PostMsgReceive() to skip building logging fields when payload logging is disabled.

Verification

Verified with existing unit tests.

@johanbrandhorst johanbrandhorst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, makes sense!

@johanbrandhorst
johanbrandhorst merged commit 390bcef into grpc-ecosystem:main Nov 1, 2025
5 checks passed
@dbeneker

dbeneker commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

Tanks for merging! I noticed that the latest release tag hasn’t been updated in quite a while. Could you create a new tag?

@johanbrandhorst

Copy link
Copy Markdown
Collaborator

Sure, done!

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

Labels

None yet

2 participants