Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dd-java-agent/agent-bootstrap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {
api project(':internal-api:internal-api-9')
api project(':dd-java-agent:agent-logging')
api project(':dd-java-agent:agent-debugger:debugger-bootstrap')
api project(':components:environment')
api project(':components:json')
api libs.slf4j
// ^ Generally a bad idea for libraries, but we're shadowing.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package datadog.trace.bootstrap;

import static datadog.environment.JavaVirtualMachine.isJavaVersionAtLeast;
import static datadog.environment.JavaVirtualMachine.isOracleJDK8;
import static datadog.trace.api.ConfigDefaults.DEFAULT_STARTUP_LOGS_ENABLED;
import static datadog.trace.api.Platform.isJavaVersionAtLeast;
import static datadog.trace.api.Platform.isOracleJDK8;
import static datadog.trace.bootstrap.Library.WILDFLY;
import static datadog.trace.bootstrap.Library.detectLibraries;
import static datadog.trace.util.AgentThreadFactory.AgentThread.JMX_STARTUP;
Expand All @@ -12,6 +12,8 @@
import static datadog.trace.util.Strings.propertyNameToSystemPropertyName;
import static datadog.trace.util.Strings.toEnvVar;

import datadog.environment.JavaVirtualMachine;
import datadog.environment.OperatingSystem;
import datadog.trace.api.Config;
import datadog.trace.api.Platform;
import datadog.trace.api.StatsDClientManager;
Expand Down Expand Up @@ -873,12 +875,12 @@ private static void startAppSec(SubscriptionService ss, Class<?> scoClass, Objec

private static boolean isSupportedAppSecArch() {
final String arch = System.getProperty("os.arch");
if (Platform.isWindows()) {
if (OperatingSystem.isWindows()) {
// TODO: Windows bindings need to be built for x86
return "amd64".equals(arch) || "x86_64".equals(arch);
} else if (Platform.isMac()) {
} else if (OperatingSystem.isMacOs()) {
return "amd64".equals(arch) || "x86_64".equals(arch) || "aarch64".equals(arch);
} else if (Platform.isLinux()) {
} else if (OperatingSystem.isLinux()) {
return "amd64".equals(arch) || "x86_64".equals(arch) || "aarch64".equals(arch);
}
// Still return true in other if unexpected cases (e.g. SunOS), and we'll handle loading errors
Expand Down Expand Up @@ -997,7 +999,7 @@ private static void stopTelemetry() {
}

private static void initializeErrorTracking() {
if (Platform.isJ9()) {
if (JavaVirtualMachine.isJ9()) {
// TODO currently crash tracking is supported only for HotSpot based JVMs
return;
}
Expand Down Expand Up @@ -1045,7 +1047,7 @@ public void withTracer(TracerAPI tracer) {
*/
private static ProfilingContextIntegration createProfilingContextIntegration() {
if (Config.get().isProfilingEnabled()) {
if (Config.get().isDatadogProfilerEnabled() && !Platform.isWindows()) {
if (Config.get().isDatadogProfilerEnabled() && !OperatingSystem.isWindows()) {
try {
return (ProfilingContextIntegration)
AGENT_CLASSLOADER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package datadog.trace.agent.tooling;

import datadog.environment.JavaVirtualMachine;
import datadog.trace.agent.tooling.bytebuddy.DDClassFileTransformer;
import datadog.trace.agent.tooling.bytebuddy.DDLocationStrategy;
import datadog.trace.agent.tooling.bytebuddy.DDOutlinePoolStrategy;
import datadog.trace.agent.tooling.bytebuddy.DDOutlineTypeStrategy;
import datadog.trace.agent.tooling.bytebuddy.DDRediscoveryStrategy;
import datadog.trace.api.Platform;
import net.bytebuddy.agent.builder.AgentBuilder.ClassFileBufferStrategy;
import net.bytebuddy.agent.builder.AgentBuilder.LocationStrategy;
import net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy;
Expand All @@ -24,7 +24,7 @@ public class AgentStrategies {
private static final Logger log = LoggerFactory.getLogger(AgentStrategies.class);

private static TransformerDecorator loadTransformerDecorator() {
if (Platform.isJavaVersionAtLeast(9)) {
if (JavaVirtualMachine.isJavaVersionAtLeast(9)) {
try {
return (TransformerDecorator)
Instrumenter.class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package datadog.trace.civisibility.ipc

import datadog.trace.api.Platform
import datadog.environment.JavaVirtualMachine
import spock.lang.IgnoreIf
import spock.lang.Specification

Expand All @@ -9,7 +9,7 @@ import java.nio.channels.ByteChannel
import java.util.concurrent.ThreadLocalRandom

@IgnoreIf(reason = "JVM crash with OpenJ9", value = {
Platform.isJ9()
JavaVirtualMachine.isJ9()
})
class ChannelContextTest extends Specification {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import static java.util.Locale.ROOT;

import com.sun.management.HotSpotDiagnosticMXBean;
import datadog.trace.api.Platform;
import datadog.environment.OperatingSystem;
import datadog.trace.util.PidHelper;
import java.io.BufferedWriter;
import java.io.IOException;
Expand Down Expand Up @@ -36,12 +36,12 @@ public static void initialize() {
}

static InputStream getCrashUploaderTemplate() {
String name = Platform.isWindows() ? "upload_crash.bat" : "upload_crash.sh";
String name = OperatingSystem.isWindows() ? "upload_crash.bat" : "upload_crash.sh";
return CrashUploader.class.getResourceAsStream(name);
}

static InputStream getOomeNotifierTemplate() {
String name = Platform.isWindows() ? "notify_oome.bat" : "notify_oome.sh";
String name = OperatingSystem.isWindows() ? "notify_oome.bat" : "notify_oome.sh";
return OOMENotifier.class.getResourceAsStream(name);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public void sourceFileProbeGroovy() throws IOException, URISyntaxException {

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Issue with J9 when compiling Kotlin code")
public void sourceFileProbeKotlin() throws IOException, URISyntaxException {
final String CLASS_NAME = "CapturedSnapshot301";
Expand Down Expand Up @@ -652,7 +652,7 @@ public void sourceFileProbeKotlin() throws IOException, URISyntaxException {

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Issue with J9 when compiling Kotlin code")
public void suspendKotlin() throws IOException, URISyntaxException {
final String CLASS_NAME = "CapturedSnapshot302";
Expand All @@ -679,7 +679,7 @@ public void suspendKotlin() throws IOException, URISyntaxException {

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Issue with J9 when compiling Kotlin code")
public void suspendMethodKotlin() {
final String CLASS_NAME = "CapturedSnapshot302";
Expand Down Expand Up @@ -712,7 +712,7 @@ public void suspendMethodKotlin() {

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Issue with J9 when compiling Kotlin code")
public void hoistVarKotlin() {
final String CLASS_NAME = "CapturedSnapshot303";
Expand Down Expand Up @@ -1863,7 +1863,7 @@ public void evaluateAtExitFalse() throws IOException, URISyntaxException {

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void uncaughtExceptionConditionLocalVar() throws IOException, URISyntaxException {
if (Config.get().getDynamicInstrumentationLocalVarHoistingLevel() < 2) {
Expand Down Expand Up @@ -1901,7 +1901,7 @@ public void uncaughtExceptionConditionLocalVar() throws IOException, URISyntaxEx

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void uncaughtExceptionCaptureLocalVars() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand All @@ -1925,7 +1925,7 @@ public void uncaughtExceptionCaptureLocalVars() throws IOException, URISyntaxExc

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void methodProbeLocalVarsLocalScopes() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand All @@ -1942,7 +1942,7 @@ public void methodProbeLocalVarsLocalScopes() throws IOException, URISyntaxExcep

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void methodProbeLocalVarsDeepScopes() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand Down Expand Up @@ -1974,7 +1974,7 @@ public void methodProbeLocalVarsDeepScopes() throws IOException, URISyntaxExcept

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void methodProbeExceptionLocalVars() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand Down Expand Up @@ -2008,7 +2008,7 @@ public void methodProbeExceptionLocalVars() throws IOException, URISyntaxExcepti

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void overlappingLocalVarSlot() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand All @@ -2025,7 +2025,7 @@ public void overlappingLocalVarSlot() throws IOException, URISyntaxException {

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "we cannot get local variable debug info")
public void duplicateLocalDifferentScope() throws IOException, URISyntaxException {
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot31";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void roundTripProbeDetails() throws IOException {

@Test
@EnabledForJreRange(min = JRE.JAVA_17)
@DisabledIf("datadog.trace.api.Platform#isJ9")
@DisabledIf("datadog.environment.JavaVirtualMachine#isJ9")
public void roundTripCapturedValue() throws IOException, URISyntaxException {
JsonAdapter<Snapshot> adapter = createSnapshotAdapter();
Snapshot snapshot = createSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void argComplexObjectArrayTemplate() {

@Test
@EnabledForJreRange(min = JRE.JAVA_17)
@DisabledIf("datadog.trace.api.Platform#isJ9")
@DisabledIf("datadog.environment.JavaVirtualMachine#isJ9")
public void argInaccessibleFieldTemplate() {
LogProbe probe = createLogProbe("{obj}");
StringTemplateBuilder summaryBuilder = new StringTemplateBuilder(probe.getSegments(), LIMITS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public void differentExceptionsSameStack() throws Exception {

@Test
@DisabledIf(
value = "datadog.trace.api.Platform#isJ9",
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Bug in J9: no LocalVariableTable for ClassFileTransformer")
public void recursive() throws Exception {
Config config = createConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ public void parseLoadedClassFromDirectory()
}

@Test
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
public void noDuplicateSymbolExtraction() {
final String CLASS_NAME_PATH = "com/datadog/debugger/symbol/SymbolExtraction01";
SymbolSink mockSymbolSink = mock(SymbolSink.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ void testScanQueuedJars() {
}

@Test
@DisabledIf(value = "datadog.trace.api.Platform#isJ9", disabledReason = "Flaky on J9 JVMs")
@DisabledIf(
value = "datadog.environment.JavaVirtualMachine#isJ9",
disabledReason = "Flaky on J9 JVMs")
void testScopeFilter() {
ScopeFilter mockFilter = mock(ScopeFilter.class);
when(mockFilter.filterOut(any())).thenReturn(true);
Expand Down
Loading