[ 
https://issues.apache.org/jira/browse/BEAM-10994?focusedWorklogId=497512&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-497512
 ]

ASF GitHub Bot logged work on BEAM-10994:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Oct/20 19:03
            Start Date: 08/Oct/20 19:03
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #12984:
URL: https://github.com/apache/beam/pull/12984#discussion_r501948250



##########
File path: 
runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/HotKeyLoggerTest.java
##########
@@ -50,11 +50,11 @@ public void SetUp() {
   }
 
   @Test
-  public void correctHotKeyMessage() {
+  public void correctHotKeyMessageWithoutKey() {
     HotKeyLogger hotKeyLogger = new HotKeyLogger(clock);
 
     assertFalse(hotKeyLogger.isThrottled());
-    String m = hotKeyLogger.getHotKeyMessage("TEST_STEP_ID", "1s");
+    String m = hotKeyLogger.getHotKeyMessage("TEST_STEP_ID", "1s", null);

Review comment:
       You can use ExpectedLogs as a test rule to capture whether output was 
produced or not instead of abstracting out a getHotKeyMessage. See 
https://github.com/apache/beam/blob/cfca7f176acb3542c7b86312f968819a1e97866e/sdks/java/core/src/test/java/org/apache/beam/sdk/coders/SerializableCoderTest.java#L259
 for an example.

##########
File path: 
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/HotKeyLogger.java
##########
@@ -67,11 +72,19 @@ protected boolean isThrottled() {
     return false;
   }
 
-  protected String getHotKeyMessage(String userStepName, String hotKeyAge) {
+  protected String getHotKeyMessage(String userStepName, String hotKeyAge, 
Object hotkey) {
+    if (hotkey == null) {
+      return MessageFormat.format(

Review comment:
       you should rely on slf4j for log formatting with parameters as we won't 
pay the cost of forming the string if logging is disabled. e.g.:
   ```LOG.warn("my message with param 1 {}, param 2 {}", param1, param2);```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 497512)
    Time Spent: 2h  (was: 1h 50m)

> Add Hot Key Logging in Dataflow Runner
> --------------------------------------
>
>                 Key: BEAM-10994
>                 URL: https://issues.apache.org/jira/browse/BEAM-10994
>             Project: Beam
>          Issue Type: New Feature
>          Components: runner-dataflow
>            Reporter: Sam Rohde
>            Assignee: Sam Rohde
>            Priority: P2
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> This adds the ability for users to enable the logging of hot key content.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to