|
48 | 48 | import java.util.ArrayList; |
49 | 49 | import java.util.Arrays; |
50 | 50 | import java.util.Collections; |
| 51 | +import java.util.HashMap; |
51 | 52 | import java.util.HashSet; |
52 | 53 | import java.util.List; |
53 | 54 | import java.util.Map; |
@@ -1321,6 +1322,21 @@ public DataflowPipelineJob run(Pipeline pipeline) { |
1321 | 1322 | if (!ExperimentalOptions.hasExperiment(options, "disable_projection_pushdown")) { |
1322 | 1323 | ProjectionPushdownOptimizer.optimize(pipeline); |
1323 | 1324 | } |
| 1325 | + SdkHarnessOptions sdkHarnessOptions = options.as(SdkHarnessOptions.class); |
| 1326 | + if (ExperimentalOptions.hasExperiment(options, "enable_otel_defaults")) { |
| 1327 | + Map<String, String> openTelemetryProperties = sdkHarnessOptions.getOpenTelemetryProperties(); |
| 1328 | + if (openTelemetryProperties == null) { |
| 1329 | + openTelemetryProperties = new HashMap<>(); |
| 1330 | + openTelemetryProperties.put("google.cloud.project", options.getProject()); |
| 1331 | + openTelemetryProperties.put( |
| 1332 | + "otel.exporter.otlp.endpoint", "https://telemetry.googleapis.com"); |
| 1333 | + openTelemetryProperties.put("otel.traces.exporter", "otlp"); |
| 1334 | + openTelemetryProperties.put("otel.java.global-autoconfigure.enabled", "true"); |
| 1335 | + openTelemetryProperties.put("otel.traces.sampler.arg", "0.01"); |
| 1336 | + openTelemetryProperties.put("otel.service.name", options.getAppName()); |
| 1337 | + sdkHarnessOptions.setOpenTelemetryProperties(openTelemetryProperties); |
| 1338 | + } |
| 1339 | + } |
1324 | 1340 |
|
1325 | 1341 | LOG.info( |
1326 | 1342 | "Executing pipeline on the Dataflow Service, which will have billing implications " |
|
0 commit comments