Skip to content

Commit 9fd1fc3

Browse files
authored
Merge branch 'master' into alejandro.gonzalez/APPSEC-57055
2 parents dde8c18 + b304f4b commit 9fd1fc3

103 files changed

Lines changed: 368 additions & 285 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static datadog.trace.api.ConfigDefaults.DEFAULT_STARTUP_LOGS_ENABLED;
44
import static datadog.trace.api.Platform.isJavaVersionAtLeast;
55
import static datadog.trace.api.Platform.isOracleJDK8;
6+
import static datadog.trace.api.telemetry.LogCollector.SEND_TELEMETRY;
67
import static datadog.trace.bootstrap.Library.WILDFLY;
78
import static datadog.trace.bootstrap.Library.detectLibraries;
89
import static datadog.trace.util.AgentThreadFactory.AgentThread.JMX_STARTUP;
@@ -44,6 +45,7 @@
4445
import datadog.trace.util.AgentTaskScheduler;
4546
import datadog.trace.util.AgentThreadFactory.AgentThread;
4647
import datadog.trace.util.throwable.FatalAgentMisconfigurationError;
48+
import de.thetaphi.forbiddenapis.SuppressForbidden;
4749
import java.lang.instrument.Instrumentation;
4850
import java.lang.reflect.InvocationTargetException;
4951
import java.lang.reflect.Method;
@@ -291,6 +293,8 @@ public static void start(
291293
codeOriginEnabled = isFeatureEnabled(AgentFeature.CODE_ORIGIN);
292294
agentlessLogSubmissionEnabled = isFeatureEnabled(AgentFeature.AGENTLESS_LOG_SUBMISSION);
293295

296+
patchJPSAccess(inst);
297+
294298
if (profilingEnabled) {
295299
if (!isOracleJDK8()) {
296300
// Profiling agent startup code is written in a way to allow `startProfilingAgent` be called
@@ -420,6 +424,23 @@ private static void injectAgentArgsConfig(String agentArgs) {
420424
}
421425
}
422426

427+
@SuppressForbidden
428+
public static void patchJPSAccess(Instrumentation inst) {
429+
if (Platform.isJavaVersionAtLeast(9)) {
430+
// Unclear if supported for J9, may need to revisit
431+
try {
432+
Class.forName("datadog.trace.util.JPMSJPSAccess")
433+
.getMethod("patchModuleAccess", Instrumentation.class)
434+
.invoke(null, inst);
435+
} catch (Exception e) {
436+
log.debug(
437+
SEND_TELEMETRY,
438+
"Failed to patch module access for jvmstat and Java version "
439+
+ Platform.getRuntimeVersion());
440+
}
441+
}
442+
}
443+
423444
public static void shutdown(final boolean sync) {
424445
StaticEventLogger.end("Agent");
425446
StaticEventLogger.stop();

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-efd-new-scenario-outline-5.4.0/events.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"test.is_retry" : "true",
9595
"test.module" : "cucumber-junit-4",
9696
"test.name" : "Many additions",
97-
"test.retry_reason" : "efd",
97+
"test.retry_reason" : "early_flake_detection",
9898
"test.status" : "pass",
9999
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples.feature:Basic Arithmetic With Examples",
100100
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -140,7 +140,7 @@
140140
"test.is_retry" : "true",
141141
"test.module" : "cucumber-junit-4",
142142
"test.name" : "Many additions",
143-
"test.retry_reason" : "efd",
143+
"test.retry_reason" : "early_flake_detection",
144144
"test.status" : "pass",
145145
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples.feature:Basic Arithmetic With Examples",
146146
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -230,7 +230,7 @@
230230
"test.is_retry" : "true",
231231
"test.module" : "cucumber-junit-4",
232232
"test.name" : "Many additions",
233-
"test.retry_reason" : "efd",
233+
"test.retry_reason" : "early_flake_detection",
234234
"test.status" : "pass",
235235
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples.feature:Basic Arithmetic With Examples",
236236
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -276,7 +276,7 @@
276276
"test.is_retry" : "true",
277277
"test.module" : "cucumber-junit-4",
278278
"test.name" : "Many additions",
279-
"test.retry_reason" : "efd",
279+
"test.retry_reason" : "early_flake_detection",
280280
"test.status" : "pass",
281281
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples.feature:Basic Arithmetic With Examples",
282282
"test.traits" : "{\"category\":[\"foo\"]}",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-efd-new-scenario-outline-latest/events.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"test.is_retry" : "true",
9595
"test.module" : "cucumber-junit-4",
9696
"test.name" : "Many additions #1",
97-
"test.retry_reason" : "efd",
97+
"test.retry_reason" : "early_flake_detection",
9898
"test.status" : "pass",
9999
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples.feature:Basic Arithmetic With Examples",
100100
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -140,7 +140,7 @@
140140
"test.is_retry" : "true",
141141
"test.module" : "cucumber-junit-4",
142142
"test.name" : "Many additions #1",
143-
"test.retry_reason" : "efd",
143+
"test.retry_reason" : "early_flake_detection",
144144
"test.status" : "pass",
145145
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples.feature:Basic Arithmetic With Examples",
146146
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -230,7 +230,7 @@
230230
"test.is_retry" : "true",
231231
"test.module" : "cucumber-junit-4",
232232
"test.name" : "Many additions #2",
233-
"test.retry_reason" : "efd",
233+
"test.retry_reason" : "early_flake_detection",
234234
"test.status" : "pass",
235235
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples.feature:Basic Arithmetic With Examples",
236236
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -276,7 +276,7 @@
276276
"test.is_retry" : "true",
277277
"test.module" : "cucumber-junit-4",
278278
"test.name" : "Many additions #2",
279-
"test.retry_reason" : "efd",
279+
"test.retry_reason" : "early_flake_detection",
280280
"test.status" : "pass",
281281
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples.feature:Basic Arithmetic With Examples",
282282
"test.traits" : "{\"category\":[\"foo\"]}",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-efd-new-slow-test/events.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"test.is_retry" : "true",
9595
"test.module" : "cucumber-junit-4",
9696
"test.name" : "Addition",
97-
"test.retry_reason" : "efd",
97+
"test.retry_reason" : "early_flake_detection",
9898
"test.status" : "pass",
9999
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_slow.feature:Basic Arithmetic",
100100
"test.traits" : "{\"category\":[\"foo\"]}",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-efd-new-test/events.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"test.is_retry" : "true",
9595
"test.module" : "cucumber-junit-4",
9696
"test.name" : "Addition",
97-
"test.retry_reason" : "efd",
97+
"test.retry_reason" : "early_flake_detection",
9898
"test.status" : "pass",
9999
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic.feature:Basic Arithmetic",
100100
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -140,7 +140,7 @@
140140
"test.is_retry" : "true",
141141
"test.module" : "cucumber-junit-4",
142142
"test.name" : "Addition",
143-
"test.retry_reason" : "efd",
143+
"test.retry_reason" : "early_flake_detection",
144144
"test.status" : "pass",
145145
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic.feature:Basic Arithmetic",
146146
"test.traits" : "{\"category\":[\"foo\"]}",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-efd-skip-new-test/events.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,4 @@
142142
},
143143
"type" : "test_module_end",
144144
"version" : 1
145-
} ]
145+
} ]

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-atr/events.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"test.is_retry" : "true",
100100
"test.module" : "cucumber-junit-4",
101101
"test.name" : "Addition",
102-
"test.retry_reason" : "atr",
102+
"test.retry_reason" : "auto_test_retry",
103103
"test.status" : "fail",
104104
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
105105
"test.test_management.is_quarantined" : "true",
@@ -148,7 +148,7 @@
148148
"test.is_retry" : "true",
149149
"test.module" : "cucumber-junit-4",
150150
"test.name" : "Addition",
151-
"test.retry_reason" : "atr",
151+
"test.retry_reason" : "auto_test_retry",
152152
"test.status" : "fail",
153153
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
154154
"test.test_management.is_quarantined" : "true",
@@ -197,7 +197,7 @@
197197
"test.is_retry" : "true",
198198
"test.module" : "cucumber-junit-4",
199199
"test.name" : "Addition",
200-
"test.retry_reason" : "atr",
200+
"test.retry_reason" : "auto_test_retry",
201201
"test.status" : "fail",
202202
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
203203
"test.test_management.is_quarantined" : "true",
@@ -247,7 +247,7 @@
247247
"test.is_retry" : "true",
248248
"test.module" : "cucumber-junit-4",
249249
"test.name" : "Addition",
250-
"test.retry_reason" : "atr",
250+
"test.retry_reason" : "auto_test_retry",
251251
"test.status" : "fail",
252252
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
253253
"test.test_management.is_quarantined" : "true",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-quarantined-failed-efd/events.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"test.is_retry" : "true",
102102
"test.module" : "cucumber-junit-4",
103103
"test.name" : "Addition",
104-
"test.retry_reason" : "efd",
104+
"test.retry_reason" : "early_flake_detection",
105105
"test.status" : "fail",
106106
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
107107
"test.test_management.is_quarantined" : "true",
@@ -152,7 +152,7 @@
152152
"test.is_retry" : "true",
153153
"test.module" : "cucumber-junit-4",
154154
"test.name" : "Addition",
155-
"test.retry_reason" : "efd",
155+
"test.retry_reason" : "early_flake_detection",
156156
"test.status" : "fail",
157157
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
158158
"test.test_management.is_quarantined" : "true",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-failure/events.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"test.is_retry" : "true",
9999
"test.module" : "cucumber-junit-4",
100100
"test.name" : "Addition",
101-
"test.retry_reason" : "atr",
101+
"test.retry_reason" : "auto_test_retry",
102102
"test.status" : "fail",
103103
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
104104
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -146,7 +146,7 @@
146146
"test.is_retry" : "true",
147147
"test.module" : "cucumber-junit-4",
148148
"test.name" : "Addition",
149-
"test.retry_reason" : "atr",
149+
"test.retry_reason" : "auto_test_retry",
150150
"test.status" : "fail",
151151
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
152152
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -194,7 +194,7 @@
194194
"test.is_retry" : "true",
195195
"test.module" : "cucumber-junit-4",
196196
"test.name" : "Addition",
197-
"test.retry_reason" : "atr",
197+
"test.retry_reason" : "auto_test_retry",
198198
"test.status" : "fail",
199199
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
200200
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -243,7 +243,7 @@
243243
"test.is_retry" : "true",
244244
"test.module" : "cucumber-junit-4",
245245
"test.name" : "Addition",
246-
"test.retry_reason" : "atr",
246+
"test.retry_reason" : "auto_test_retry",
247247
"test.status" : "fail",
248248
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_failed.feature:Basic Arithmetic",
249249
"test.traits" : "{\"category\":[\"foo\"]}",

dd-java-agent/instrumentation/junit-4.10/cucumber-junit-4/src/test/resources/test-retry-scenario-outline-5.4.0/events.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
"test.is_retry" : "true",
185185
"test.module" : "cucumber-junit-4",
186186
"test.name" : "Many additions",
187-
"test.retry_reason" : "atr",
187+
"test.retry_reason" : "auto_test_retry",
188188
"test.status" : "fail",
189189
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples_failed.feature:Basic Arithmetic With Examples",
190190
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -232,7 +232,7 @@
232232
"test.is_retry" : "true",
233233
"test.module" : "cucumber-junit-4",
234234
"test.name" : "Many additions",
235-
"test.retry_reason" : "atr",
235+
"test.retry_reason" : "auto_test_retry",
236236
"test.status" : "fail",
237237
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples_failed.feature:Basic Arithmetic With Examples",
238238
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -280,7 +280,7 @@
280280
"test.is_retry" : "true",
281281
"test.module" : "cucumber-junit-4",
282282
"test.name" : "Many additions",
283-
"test.retry_reason" : "atr",
283+
"test.retry_reason" : "auto_test_retry",
284284
"test.status" : "fail",
285285
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples_failed.feature:Basic Arithmetic With Examples",
286286
"test.traits" : "{\"category\":[\"foo\"]}",
@@ -329,7 +329,7 @@
329329
"test.is_retry" : "true",
330330
"test.module" : "cucumber-junit-4",
331331
"test.name" : "Many additions",
332-
"test.retry_reason" : "atr",
332+
"test.retry_reason" : "auto_test_retry",
333333
"test.status" : "fail",
334334
"test.suite" : "classpath:org/example/cucumber/calculator/basic_arithmetic_with_examples_failed.feature:Basic Arithmetic With Examples",
335335
"test.traits" : "{\"category\":[\"foo\"]}",

0 commit comments

Comments
 (0)