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 2021/09/27 18:19:50 UTC

[GitHub] [beam] ajamato commented on a change in pull request #15597: [BEAM-12611] Capture a greater proporition of logs associated to an instruction by moving setting the MDC out to the BeamFnControlClient instead of the ProcessBundleHandler.

ajamato commented on a change in pull request #15597:
URL: https://github.com/apache/beam/pull/15597#discussion_r716935118



##########
File path: sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/BeamFnControlClient.java
##########
@@ -102,18 +103,26 @@ public BeamFnControlClient(
     }
 
     @Override
-    public void onNext(BeamFnApi.InstructionRequest value) {
-      LOG.debug("Received InstructionRequest {}", value);
-      executor.execute(
-          () -> {
-            try {
-              BeamFnApi.InstructionResponse response = delegateOnInstructionRequestType(value);
-              sendInstructionResponse(response);
-            } catch (Error e) {
-              sendErrorResponse(e);
-              throw e;
-            }
-          });
+    public void onNext(BeamFnApi.InstructionRequest request) {
+      try {
+        BeamFnLoggingMDC.setInstructionId(request.getInstructionId());
+        LOG.debug("Received InstructionRequest {}", request);
+        executor.execute(
+            () -> {
+              try {
+                BeamFnLoggingMDC.setInstructionId(request.getInstructionId());

Review comment:
       nit: Maybe add a comment stating that the callback runs on a separate thread, which is why we need to set the instruction id here as well, might not be obvious to every reader.




-- 
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: github-unsubscribe@beam.apache.org

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