8000 Added special lightweight pre-main class that skips installation on incompatible JVMs. by AlexeyKuznetsov-DD · Pull Request #8855 · DataDog/dd-trace-java · GitHub
[go: up one dir, main page]

Skip to content

Added special lightweight pre-main class that skips installation on incompatible JVMs. #8855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5e9b6ba
Added special lightweight pre-main class to enable SSI inject for Jav…
AlexeyKuznetsov-DD May 20, 2025
c40db79
Fixed SuppressForbidden test.
AlexeyKuznetsov-DD May 20, 2025
125a148
Refactored pre-check logic.
AlexeyKuznetsov-DD May 23, 2025
1e7ecd1
Merge branch 'master' into ssi-inject-java-6
AlexeyKuznetsov-DD May 23, 2025
99abf99
Refactored build.gradle to reuse existing functions.
AlexeyKuznetsov-DD May 23, 2025
2eb2753
Minor cleanup.
AlexeyKuznetsov-DD May 23, 2025
0c2e817
Added missing `@SuppressForbidden`.
AlexeyKuznetsov-DD May 23, 2025
45fb91f
Merge branch 'master' into ssi-inject-java-6
AlexeyKuznetsov-DD May 23, 2025
78dc42b
Merge branch 'master' into ssi-inject-java-6
AlexeyKuznetsov-DD May 23, 2025
ea5bea7
Added 'java.home' to warning. That would help to identify problematic…
AlexeyKuznetsov-DD May 23, 2025
5695279
Merge branch 'master' into ssi-inject-java-6
AlexeyKuznetsov-DD May 23, 2025
9238f7d
Added test to ensure Java 6 & 8 compilation.
AlexeyKuznetsov-DD May 24, 2025
10d60a0
Merge branch 'master' into ssi-inject-java-6
AlexeyKuznetsov-DD May 24, 2025
5f61b62
Fixed test.
AlexeyKuznetsov-DD May 24, 2025
5fa1bb6
Drop support for 0.x version.
AlexeyKuznetsov-DD May 27, 2025
985412f
Merge branch 'master' into ssi-inject-java-6
AlexeyKuznetsov-DD May 27, 2025
8000 be58d6b
Fixed small typo.
AlexeyKuznetsov-DD May 27, 2025
7c2a597
Fixed test.
AlexeyKuznetsov-DD May 27, 2025
8192ac4
Update dd-java-agent/src/main/java6/datadog/trace/bootstrap/AgentPreC…
AlexeyKuznetsov-DD May 28, 2025
1037295
Merge branch 'master' into ssi-inject-java-6
AlexeyKuznetsov-DD May 28, 2025
e1df6fe
Fixed test.
AlexeyKuznetsov-DD May 28, 2025
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
Prev Previous commit
Next Next commit
Drop support for 0.x version.
  • Loading branch information
AlexeyKuznetsov-DD committed May 27, 2025
commit 5fa1bb6beca605e70c7c23978bc3d3714ab4d1fb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ public static void agentmain(final String agentArgs, final Instrumentation inst)
}

private static void reportIncompatibleJava(
String javaVersion,
int majorJavaVersion,
String javaHome,
String agentVersion,
PrintStream output) {
String javaVersion, String javaHome, String agentVersion, PrintStream output) {
output.println(
"Warning: "
+ (agentVersion == null ? "This version" : "Version " + agentVersion)
Expand All @@ -42,13 +38,7 @@ private static void reportIncompatibleJava(
+ " found at '"
+ javaHome
+ "' and will not be installed.");

String msg = "Please upgrade your Java version to 8+";
if (majorJavaVersion == 7) {
msg +=
" or use the 0.x version of dd-java-agent in your build tool or download it from https://dtdg.co/java-tracer-v0";
}
output.println(msg);
output.println("Please upgrade your Java version to 8+");
}

static void sendTelemetry(String forwarderPath, String javaVersion, String agentVersion) {
Expand Down Expand Up @@ -103,7 +93,7 @@ static boolean compatible(String javaVersion, String javaHome, PrintStream outpu

String agentVersion = getAgentVersion();

reportIncompatibleJava(javaVersion, majorJavaVersion, javaHome, agentVersion, output);
reportIncompatibleJava(javaVersion, javaHome, agentVersion, output);

String forwarderPath = System.getenv("DD_TELEMETRY_FORWARDER_PATH");
if (forwarderPath != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AgentPreCheckTest extends Specification {
logLines.size() == 2
def expectedLogLines = [
"Warning: Version ${AgentJar.getAgentVersion()} of dd-java-agent is not compatible with Java $javaVersion found at '/Library/$javaVersion' and will not be installed.",
"Please upgrade your Java version to 8+" + (AgentPreCheck.parseJavaMajorVersion(javaVersion) == 7 ? " or use the 0.x version of dd-java-agent in your build tool or download it from https://dtdg.co/java-tracer-v0" : "")
"Please upgrade your Java version to 8+"
]
assert logLines == expectedLogLines
}
Expand Down Expand Up @@ -152,7 +152,7 @@ class AgentPreCheckTest extends Specification {
def minor = (int) it.readShort()
def major = (int) it.readShort()

assert magic == 0xCAFEBABE
assert magic == 0xCAFEBABEL
assert minor == 0
assert major == expectedMajor
} == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class StartWithAgentTest {

private static final Pattern WARNING_PATTERN = Pattern.compile("^Warning: Version [^ ]+ of dd-java-agent is not compatible with Java [^ ]+ and will not be installed\\.$");
private static final String UPGRADE_MESSAGE = "Please upgrade your Java version to 8+ or use the 0.x version of dd-java-agent in your build tool or download it from https://dtdg.co/java-tracer-v0";
private static final String UPGRADE_MESSAGE = "Please upgrade your Java version to 8+";

@Test
void ensureThatApplicationStartsWithAgentOnJava7() throws InterruptedException, IOException {
Expand Down
Loading
0