Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][client]Add logging for message size exceeding the configured threshold before throwing exception #23681

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mukesh154
Copy link
Contributor

Motivation

The current behavior does not provide clear visibility when the message size exceeds the configured maximum size, often leading to InvalidMessageException error. This change introduces a log statement to notify when the message size exceeds the threshold, helping users identify and troubleshoot message size issues more easily.

Modifications

Added a log.warn statement before releasing the semaphore and throwing the InvalidMessageException.
The log includes details about the message size, the configured threshold, and the producer/topic involved, improving visibility for debugging and troubleshooting.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 4, 2024
// Log the message size exceeding the limit
log.warn("Message size exceeded: Producer {} attempted to send a message of {} bytes, "
+ "exceeding the configured maximum size of {} bytes on topic {}.",
producerName, messageSize, maxMessageSize, topic);
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems useless for this log, the client could get the exception with log below.

Copy link
Member

Choose a reason for hiding this comment

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

+1, the exception can be propagated to the send oeration.

@lhotari
Copy link
Member

lhotari commented Dec 20, 2024

There doesn't seem to be a need to log this since it's already part of the exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants