gemini-code-assist[bot] commented on code in PR #38940:
URL: https://github.com/apache/beam/pull/38940#discussion_r3403214058


##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java:
##########
@@ -1059,6 +1059,10 @@ public static void main(String[] args) throws Exception {
             }
           });
       LOG.info("Enabled Open Telemetry with properties: {}", 
openTelemetryProperties);
+    } else {
+      // turn off auth extension so it doesn't interfere if user is 
configuring otel e.g. via
+      // JvmInitializer.
+      System.setProperty("google.otel.auth.target.signals", "none");
     }

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Unconditionally setting the system property 
`google.otel.auth.target.signals` will overwrite any value explicitly 
configured by the user (e.g., via command-line JVM arguments like 
`-Dgoogle.otel.auth.target.signals=...`). It is safer to check if the property 
is already set before overriding it.
   
   ```suggestion
       } else {
         // turn off auth extension so it doesn't interfere if user is 
configuring otel e.g. via
         // JvmInitializer.
         if (System.getProperty("google.otel.auth.target.signals") == null) {
           System.setProperty("google.otel.auth.target.signals", "none");
         }
       }
   ```



##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnHarness.java:
##########
@@ -306,6 +306,10 @@ public static void main(
               }
             });
         LOG.info("Enabled Open Telemetry with properties: {}", 
openTelemetryProperties);
+      } else {
+        // turn off auth extension so it doesn't interfere if user is 
configuring otel e.g. via
+        // JvmInitializer.
+        System.setProperty("google.otel.auth.target.signals", "none");
       }

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Unconditionally setting the system property 
`google.otel.auth.target.signals` will overwrite any value explicitly 
configured by the user (e.g., via command-line JVM arguments like 
`-Dgoogle.otel.auth.target.signals=...`). It is safer to check if the property 
is already set before overriding it.
   
   ```java
         } else {
           // turn off auth extension so it doesn't interfere if user is 
configuring otel e.g. via
           // JvmInitializer.
           if (System.getProperty("google.otel.auth.target.signals") == null) {
             System.setProperty("google.otel.auth.target.signals", "none");
           }
         }
   ```



-- 
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: [email protected]

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

Reply via email to