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


##########
runners/google-cloud-dataflow-java/build.gradle:
##########
@@ -113,6 +113,12 @@ dependencies {
   implementation library.java.google_cloud_logging
   permitUnusedDeclared library.java.google_cloud_logging // BEAM-11761
   implementation library.java.opentelemetry_context
+  implementation library.java.opentelemetry_exporter_otlp
+  permitUnusedDeclared library.java.opentelemetry_exporter_otlp
+  implementation library.java.opentelemetry_extension_autoconfigure
+  permitUnusedDeclared library.java.opentelemetry_extension_autoconfigure
+  implementation 
project(":sdks:java:extensions:opentelemetry-gcp-auth-extension")
+  permitUnusedDeclared 
project(":sdks:java:extensions:opentelemetry-gcp-auth-extension")

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Since these OpenTelemetry dependencies (exporter, autoconfigure, and GCP 
auth extension) are only needed at runtime for auto-configuration and SPI 
loading, they should be declared as `runtimeOnly` instead of `implementation`.
   
   Using `runtimeOnly` is cleaner because:
   1. It avoids polluting the compile classpath.
   2. It eliminates the need for `permitUnusedDeclared` annotations, as 
dependency analysis tools do not flag `runtimeOnly` dependencies as unused 
compile dependencies.
   
   ```
     runtimeOnly library.java.opentelemetry_exporter_otlp
     runtimeOnly library.java.opentelemetry_extension_autoconfigure
     runtimeOnly 
project(":sdks:java:extensions:opentelemetry-gcp-auth-extension")
   ```



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