Skip to content

Commit 5c59d21

Browse files
committed
feat(env): Migrate agent bootstrap to environment component
1 parent f2070e5 commit 5c59d21

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentJar.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package datadog.trace.bootstrap;
22

3+
import datadog.environment.SystemProperties;
34
import de.thetaphi.forbiddenapis.SuppressForbidden;
45
import java.io.BufferedReader;
56
import java.io.IOException;
@@ -174,7 +175,7 @@ public static String getAgentVersion() throws IOException {
174175
}
175176

176177
private static void checkProfilerEnv(final String[] args) throws Exception {
177-
String tmpDir = args.length == 2 ? args[1] : System.getProperty("java.io.tmpdir");
178+
String tmpDir = args.length == 2 ? args[1] : SystemProperties.get("java.io.tmpdir");
178179

179180
installAgentCLI().getMethod("checkProfilerEnv", String.class).invoke(null, tmpDir);
180181
}

dd-java-agent/src/test/groovy/datadog/trace/agent/InitializationTelemetryTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ class InitializationTelemetryTest extends Specification {
5555

5656
def "incomplete agent start-up"() {
5757
// In this case, the SecurityManager blocks a custom permission that is checked by bytebuddy causing
58-
// agent initialization to fail. However, we should catch the exception allowing the application
58+
// agent initialization to fail. However, we should catch the exception allowing the application
5959
// to run normally.
6060
when:
6161
def result = InitializationTelemetryCheck.runTestJvm(InitializationTelemetryCheck.BlockByteBuddy)
6262

6363
then:
6464
result.exitCode == 0
6565
!result.telemetryJson.contains('library_entrypoint.complete')
66-
result.telemetryJson.contains('error_type:java.lang.IllegalStateException')
66+
result.telemetryJson.contains('error_type:java.lang.reflect.InvocationTargetException')
6767
}
6868

6969
def "block forwarder env var"() {

0 commit comments

Comments
 (0)