You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/10/13 17:49:23 UTC

[GitHub] [beam] lukecwik commented on a change in pull request #12986: [BEAM-10994] Adds ability to log literal hot key in Streaming Dataflow

lukecwik commented on a change in pull request #12986:
URL: https://github.com/apache/beam/pull/12986#discussion_r504144683



##########
File path: runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java
##########
@@ -1384,6 +1374,17 @@ private void process(
       Object executionKey =
           keyCoder == null ? null : keyCoder.decode(key.newInput(), Coder.Context.OUTER);
 
+      if (workItem.hasHotKeyInfo()) {
+        Windmill.HotKeyInfo hotKeyInfo = workItem.getHotKeyInfo();
+        Duration hotKeyAge = Duration.millis(hotKeyInfo.getHotKeyAgeUsec() / 1000);
+
+        // The MapTask instruction is ordered by dependencies, such that the first element is
+        // always going to be the shuffle task.
+        String stepName = computationState.getMapTask().getInstructions().get(0).getName();
+        Object hotkey = options.isHotKeyLoggingEnabled() ? executionKey : null;
+        hotKeyLogger.logHotKeyDetection(stepName, hotKeyAge, hotkey);

Review comment:
       See my earlier comment on #12984  about assuming that `key == null` is the same thing as not present.




----------------------------------------------------------------
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:
users@infra.apache.org