-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Optimize the debug log that affects performance, and unify the style #13498
Optimize the debug log that affects performance, and unify the style #13498
Conversation
@liudezhi2098:Thanks for your contribution. For this PR, do we need to update docs? |
@@ -105,7 +105,9 @@ public void add(T event, long ts, Record<?> record) { | |||
public void add(Event<T> windowEvent) { | |||
// watermark events are not added to the queue. | |||
if (windowEvent.isWatermark()) { | |||
log.debug(String.format("Got watermark event with ts %d", windowEvent.getTimestamp())); | |||
if (log.isDebugEnabled()) { | |||
log.debug(String.format("Got watermark event with ts %d", windowEvent.getTimestamp())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use String.format, just
log.debug("Got watermark event with ts {}", windowEvent.getTimestamp());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes , I will delete
log.debug(String.format("invoking windowLifecycleListener onActivation, [%d] events in " | ||
+ "window.", events.size())); | ||
if (log.isDebugEnabled()) { | ||
log.debug(String.format("invoking windowLifecycleListener onActivation, [%d] events in " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@@ -216,7 +220,9 @@ private void track(Event<T> windowEvent) { | |||
lock.unlock(); | |||
} | |||
eventsSinceLastExpiry.set(0); | |||
log.debug(String.format("[%d] events expired from window.", eventsToExpire.size())); | |||
if (log.isDebugEnabled()) { | |||
log.debug(String.format("[%d] events expired from window.", eventsToExpire.size())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
Master Issue: #13497
Motivation
Optimize the debug log that affects performance, and unify the style
Modifications
add isDebugEnabled method
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
no-need-doc