You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/12/25 05:41:44 UTC

[GitHub] [pulsar] liudezhi2098 opened a new pull request #13498: Optimize the debug log that affects performance, and unify the style

liudezhi2098 opened a new pull request #13498:
URL: https://github.com/apache/pulsar/pull/13498


   Master Issue: #13497
   ### Motivation
   Optimize the debug log that affects performance, and unify the style
   
   ### Modifications
   add isDebugEnabled method
   
   ```java
    if (log.isDebugEnabled()) {
       log.debug();
   }
   ```
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: ( no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
     
   ### Documentation
   
   Check the box below and label this PR (if you have committer privilege).
   
   Need to update docs? 
     
   - [x]  `no-need-doc`
     


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] github-actions[bot] commented on pull request #13498: Optimize the debug log that affects performance, and unify the style

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #13498:
URL: https://github.com/apache/pulsar/pull/13498#issuecomment-1000978081


   @liudezhi2098:Thanks for your contribution. For this PR, do we need to update docs?
   (The [PR template contains info about doc](https://github.com/apache/pulsar/blob/master/.github/PULL_REQUEST_TEMPLATE.md#documentation), which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui merged pull request #13498: Optimize the debug log that affects performance, and unify the style

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #13498:
URL: https://github.com/apache/pulsar/pull/13498


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liudezhi2098 commented on pull request #13498: Optimize the debug log that affects performance, and unify the style

Posted by GitBox <gi...@apache.org>.
liudezhi2098 commented on pull request #13498:
URL: https://github.com/apache/pulsar/pull/13498#issuecomment-1001090972


   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] Jason918 commented on a change in pull request #13498: Optimize the debug log that affects performance, and unify the style

Posted by GitBox <gi...@apache.org>.
Jason918 commented on a change in pull request #13498:
URL: https://github.com/apache/pulsar/pull/13498#discussion_r775127086



##########
File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/windowing/WindowManager.java
##########
@@ -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()));

Review comment:
       No need to use String.format, just 
   log.debug("Got watermark event with ts {}", windowEvent.getTimestamp());
   

##########
File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/windowing/WindowManager.java
##########
@@ -145,8 +147,10 @@ public boolean onTrigger() {
         prevWindowEvents.clear();
         if (!events.isEmpty()) {
             prevWindowEvents.addAll(windowEvents);
-            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 "

Review comment:
       Same here

##########
File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/windowing/WindowManager.java
##########
@@ -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()));

Review comment:
       Same here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liudezhi2098 commented on a change in pull request #13498: Optimize the debug log that affects performance, and unify the style

Posted by GitBox <gi...@apache.org>.
liudezhi2098 commented on a change in pull request #13498:
URL: https://github.com/apache/pulsar/pull/13498#discussion_r775129571



##########
File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/windowing/WindowManager.java
##########
@@ -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()));

Review comment:
       yes , I will delete




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] liudezhi2098 commented on pull request #13498: Optimize the debug log that affects performance, and unify the style

Posted by GitBox <gi...@apache.org>.
liudezhi2098 commented on pull request #13498:
URL: https://github.com/apache/pulsar/pull/13498#issuecomment-1001020128


   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org