|
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; |
@@ -1327,6 +1328,21 @@ public DataflowPipelineJob run(Pipeline pipeline) { |
1327 | 1328 | if (!ExperimentalOptions.hasExperiment(options, "disable_projection_pushdown")) { |
1328 | 1329 | ProjectionPushdownOptimizer.optimize(pipeline); |
1329 | 1330 | } |
| 1331 | + SdkHarnessOptions sdkHarnessOptions = options.as(SdkHarnessOptions.class); |
| 1332 | + if (ExperimentalOptions.hasExperiment(options, "enable_otel_defaults")) { |
| 1333 | + Map<String, String> openTelemetryProperties = sdkHarnessOptions.getOpenTelemetryProperties(); |
| 1334 | + if (openTelemetryProperties == null) { |
| 1335 | + openTelemetryProperties = new HashMap<>(); |
| 1336 | + openTelemetryProperties.put("google.cloud.project", options.getProject()); |
| 1337 | + openTelemetryProperties.put( |
| 1338 | + "otel.exporter.otlp.endpoint", "https://telemetry.googleapis.com"); |
| 1339 | + openTelemetryProperties.put("otel.traces.exporter", "otlp"); |
| 1340 | + openTelemetryProperties.put("otel.java.global-autoconfigure.enabled", "true"); |
| 1341 | + openTelemetryProperties.put("otel.traces.sampler.arg", "0.01"); |
| 1342 | + openTelemetryProperties.put("otel.service.name", options.getAppName()); |
| 1343 | + sdkHarnessOptions.setOpenTelemetryProperties(openTelemetryProperties); |
| 1344 | + } |
| 1345 | + } |
1330 | 1346 |
|
1331 | 1347 | LOG.info( |
1332 | 1348 | "Executing pipeline on the Dataflow Service, which will have billing implications " |
|
0 commit comments