|
39 | 39 | import java.util.concurrent.TimeoutException; |
40 | 40 | import java.util.function.Predicate; |
41 | 41 | import java.util.stream.Stream; |
| 42 | +import jnr.ffi.Runtime; |
42 | 43 | import okhttp3.mockwebserver.Dispatcher; |
43 | 44 | import okhttp3.mockwebserver.MockResponse; |
44 | 45 | import okhttp3.mockwebserver.MockWebServer; |
@@ -868,52 +869,44 @@ private static ProcessBuilder createProcessBuilder( |
868 | 869 | .getResource("overrides.jfp") |
869 | 870 | .getFile(); |
870 | 871 |
|
871 | | - final List<String> command = new java.util.ArrayList<>(); |
872 | | - command.add(javaPath()); |
873 | | - command.add("-Xmx" + System.getProperty("datadog.forkedMaxHeapSize", "1024M")); |
874 | | - command.add("-Xms" + System.getProperty("datadog.forkedMinHeapSize", "64M")); |
875 | | - command.add("-javaagent:" + agentShadowJar()); |
876 | | - command.add("-XX:ErrorFile=/tmp/hs_err_pid%p.log"); |
877 | | - command.add("-Ddd.trace.agent.port=" + tracerPort); |
878 | | - if (!tracingEnabled) { |
879 | | - command.add("-Ddd.trace.enabled=false"); |
880 | | - } |
881 | | - command.add("-Ddd.service.name=smoke-test-java-app"); |
882 | | - command.add("-Ddd.env=smoketest"); |
883 | | - command.add("-Ddd.version=99"); |
884 | | - command.add("-Ddd.profiling.enabled=true"); |
885 | | - command.add("-Ddd.profiling.stackdepth=" + STACK_DEPTH_LIMIT); |
886 | | - command.add("-Ddd.profiling.ddprof.enabled=" + asyncProfilerEnabled); |
887 | | - command.add("-Ddd.profiling.ddprof.alloc.enabled=" + asyncProfilerEnabled); |
888 | | - if (!tracingEnabled && asyncProfilerEnabled) { |
889 | | - command.add("-Ddd.profiling.ddprof.wall.enabled=true"); |
890 | | - } |
891 | | - command.add("-Ddd.profiling.agentless=" + (apiKey != null)); |
892 | | - command.add("-Ddd.profiling.start-delay=" + profilingStartDelaySecs); |
893 | | - command.add("-Ddd.profiling.upload.period=" + profilingUploadPeriodSecs); |
894 | | - command.add("-Ddd.profiling.url=http://localhost:" + profilerPort); |
895 | | - command.add("-Ddd.profiling.hotspots.enabled=true"); |
896 | | - command.add("-Ddd.profiling.endpoint.collection.enabled=" + endpointCollectionEnabled); |
897 | | - command.add("-Ddd.profiling.upload.timeout=" + PROFILING_UPLOAD_TIMEOUT_SECONDS); |
898 | | - command.add("-Ddd.profiling.debug.dump_path=/tmp/dd-profiler"); |
899 | | - if (tracingEnabled) { |
900 | | - command.add("-Ddd.profiling.queueing.time.enabled=true"); |
901 | | - command.add("-Ddd.profiling.queueing.time.threshold.millis=0"); |
902 | | - command.add("-Ddd.profiling.context.attributes=foo,bar"); |
903 | | - } |
904 | | - command.add("-Ddd.profiling.debug.upload.compression=" + withCompression); |
905 | | - command.add("-Ddatadog.slf4j.simpleLogger.defaultLogLevel=debug"); |
906 | | - command.add("-Dorg.slf4j.simpleLogger.defaultLogLevel=debug"); |
907 | | - command.add("-XX:+IgnoreUnrecognizedVMOptions"); |
908 | | - command.add("-XX:+UnlockCommercialFeatures"); |
909 | | - command.add("-XX:+FlightRecorder"); |
910 | | - command.add( |
911 | | - "-Ddd." + ProfilingConfig.PROFILING_TEMPLATE_OVERRIDE_FILE + "=" + templateOverride); |
912 | | - command.add("-Ddd.jmxfetch.start-delay=" + jmxFetchDelaySecs); |
913 | | - command.add("-jar"); |
914 | | - command.add(profilingShadowJar()); |
915 | | - command.add(Integer.toString(exitDelay)); |
916 | | - |
| 872 | + final List<String> command = |
| 873 | + Arrays.asList( |
| 874 | + javaPath(), |
| 875 | + "-Xmx" + System.getProperty("datadog.forkedMaxHeapSize", "1024M"), |
| 876 | + "-Xms" + System.getProperty("datadog.forkedMinHeapSize", "64M"), |
| 877 | + "-javaagent:" + agentShadowJar(), |
| 878 | + "-XX:ErrorFile=/tmp/hs_err_pid%p.log", |
| 879 | + "-Ddd.trace.agent.port=" + tracerPort, |
| 880 | + "-Ddd.service.name=smoke-test-java-app", |
| 881 | + "-Ddd.env=smoketest", |
| 882 | + "-Ddd.version=99", |
| 883 | + "-Ddd.trace.enabled=" + tracingEnabled, |
| 884 | + "-Ddd.profiling.enabled=true", |
| 885 | + "-Ddd.profiling.stackdepth=" + STACK_DEPTH_LIMIT, |
| 886 | + "-Ddd.profiling.ddprof.enabled=" + asyncProfilerEnabled, |
| 887 | + "-Ddd.profiling.ddprof.alloc.enabled=" + asyncProfilerEnabled, |
| 888 | + "-Ddd.profiling.agentless=" + (apiKey != null), |
| 889 | + "-Ddd.profiling.start-delay=" + profilingStartDelaySecs, |
| 890 | + "-Ddd.profiling.upload.period=" + profilingUploadPeriodSecs, |
| 891 | + "-Ddd.profiling.url=http://localhost:" + profilerPort, |
| 892 | + "-Ddd.profiling.hotspots.enabled=true", |
| 893 | + "-Ddd.profiling.endpoint.collection.enabled=" + endpointCollectionEnabled, |
| 894 | + "-Ddd.profiling.upload.timeout=" + PROFILING_UPLOAD_TIMEOUT_SECONDS, |
| 895 | + "-Ddd.profiling.debug.dump_path=/tmp/dd-profiler", |
| 896 | + "-Ddd.profiling.queueing.time.enabled=true", |
| 897 | + "-Ddd.profiling.queueing.time.threshold.millis=0", |
| 898 | + "-Ddd.profiling.debug.upload.compression=" + withCompression, |
| 899 | + "-Ddatadog.slf4j.simpleLogger.defaultLogLevel=debug", |
| 900 | + "-Ddd.profiling.context.attributes=foo,bar", |
| 901 | + "-Dorg.slf4j.simpleLogger.defaultLogLevel=debug", |
| 902 | + "-XX:+IgnoreUnrecognizedVMOptions", |
| 903 | + "-XX:+UnlockCommercialFeatures", |
| 904 | + "-XX:+FlightRecorder", |
| 905 | + "-Ddd." + ProfilingConfig.PROFILING_TEMPLATE_OVERRIDE_FILE + "=" + templateOverride, |
| 906 | + "-Ddd.jmxfetch.start-delay=" + jmxFetchDelaySecs, |
| 907 | + "-jar", |
| 908 | + profilingShadowJar(), |
| 909 | + Integer.toString(exitDelay)); |
917 | 910 | final ProcessBuilder processBuilder = new ProcessBuilder(command); |
918 | 911 | processBuilder.directory(new File(buildDirectory())); |
919 | 912 |
|
|
0 commit comments