Skip to content

Commit 3b948d3

Browse files
Merge branch 'master' into landerson/artifactual-proxy
2 parents 9939764 + ef1ed74 commit 3b948d3

72 files changed

Lines changed: 791 additions & 255 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.

.gitlab-ci.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -455,22 +455,9 @@ requirements_json_test:
455455
package-oci:
456456
needs: [ build ]
457457

458-
onboarding_tests_installer:
459-
parallel:
460-
matrix:
461-
- ONBOARDING_FILTER_WEBLOG: [test-app-java, test-app-java-container, test-app-java-alpine]
462-
SCENARIO: [ SIMPLE_INSTALLER_AUTO_INJECTION, SIMPLE_AUTO_INJECTION_PROFILING ]
463-
464-
onboarding_tests_k8s_injection:
465-
parallel:
466-
matrix:
467-
- WEBLOG_VARIANT: [dd-lib-java-init-test-app]
468-
SCENARIO: [K8S_LIB_INJECTION, K8S_LIB_INJECTION_UDS, K8S_LIB_INJECTION_NO_AC, K8S_LIB_INJECTION_NO_AC_UDS, K8S_LIB_INJECTION_PROFILING_DISABLED, K8S_LIB_INJECTION_PROFILING_ENABLED, K8S_LIB_INJECTION_PROFILING_OVERRIDE]
469-
K8S_CLUSTER_VERSION: ['7.56.2', '7.57.0', '7.59.0']
470-
471-
- WEBLOG_VARIANT: [dd-djm-spark-test-app]
472-
SCENARIO: [K8S_LIB_INJECTION_SPARK_DJM]
473-
K8S_CLUSTER_VERSION: ['7.57.0', '7.59.0']
458+
configure_system_tests:
459+
variables:
460+
SYSTEM_TESTS_SCENARIOS_GROUPS: "simple_onboarding,simple_onboarding_profiling,docker-ssi,lib-injection"
474461

475462
create_key:
476463
stage: generate-signing-key

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/AdviceUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
44
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.isAsyncPropagationEnabled;
5-
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.setAsyncPropagationEnabled;
65

76
import datadog.trace.bootstrap.ContextStore;
87
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
@@ -29,7 +28,6 @@ public static AgentScope startTaskScope(State state) {
2928
final AgentScope.Continuation continuation = state.getAndResetContinuation();
3029
if (continuation != null) {
3130
final AgentScope scope = continuation.activate();
32-
setAsyncPropagationEnabled(true);
3331
// important - stop timing after the scope has been activated so the time in the queue can
3432
// be attributed to the correct context without duplicating the propagated information
3533
state.stopTiming();
@@ -54,7 +52,7 @@ public static <T> void cancelTask(ContextStore<T, State> contextStore, final T t
5452

5553
public static <T> void capture(ContextStore<T, State> contextStore, T task) {
5654
AgentSpan span = activeSpan();
57-
if (span != null && isAsyncPropagationEnabled()) {
55+
if (span != null && span.isValid() && isAsyncPropagationEnabled()) {
5856
State state = contextStore.get(task);
5957
if (null == state) {
6058
state = State.FACTORY.create();

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/java/concurrent/ExecutorInstrumentationUtils.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package datadog.trace.bootstrap.instrumentation.java.concurrent;
22

3-
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
43
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.isAsyncPropagationEnabled;
54
import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter.ExcludeType;
65

76
import datadog.trace.bootstrap.ContextStore;
87
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
9-
import java.util.concurrent.Executor;
108
import org.slf4j.Logger;
119
import org.slf4j.LoggerFactory;
1210

@@ -19,17 +17,17 @@ public final class ExecutorInstrumentationUtils {
1917
* Checks if given task should get state attached.
2018
*
2119
* @param task task object
22-
* @param executor executor this task was scheduled on
20+
* @param span active span
2321
* @return true iff given task object should be wrapped
2422
*/
25-
public static boolean shouldAttachStateToTask(final Object task, final Executor executor) {
23+
public static boolean shouldAttachStateToTask(final Object task, final AgentSpan span) {
2624
if (task == null) {
2725
return false;
2826
}
2927
if (ExcludeFilter.exclude(ExcludeType.EXECUTOR, task)) {
3028
return false;
3129
}
32-
return activeSpan() != null && isAsyncPropagationEnabled();
30+
return span != null && span.isValid() && isAsyncPropagationEnabled();
3331
}
3432

3533
/**
@@ -57,12 +55,10 @@ public static <T> State setupState(
5755
/**
5856
* Clean up after job submission method has exited.
5957
*
60-
* @param executor the current executor
6158
* @param state task instrumentation state
6259
* @param throwable throwable that may have been thrown
6360
*/
64-
public static void cleanUpOnMethodExit(
65-
final Executor executor, final State state, final Throwable throwable) {
61+
public static void cleanUpOnMethodExit(final State state, final Throwable throwable) {
6662
if (null != state && null != throwable) {
6763
/*
6864
Note: this may potentially close somebody else's continuation if we didn't set it

dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/AdviceShader.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ public byte[] shadeClass(byte[] bytecode) {
6565
public String uniqueHelper(String dottedName) {
6666
int packageEnd = dottedName.lastIndexOf('.');
6767
if (packageEnd > 0) {
68-
return dottedName.substring(0, packageEnd + 1) + "shaded" + dottedName.substring(packageEnd);
68+
return dottedName.substring(0, packageEnd + 1)
69+
+ "shaded"
70+
+ relocations.hashCode()
71+
+ dottedName.substring(packageEnd);
6972
}
7073
return dottedName;
7174
}

dd-java-agent/appsec/src/main/java/com/datadog/appsec/event/data/KnownAddresses.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ public interface KnownAddresses {
133133
/** Login success business event */
134134
Address<String> LOGIN_SUCCESS = new Address<>("server.business_logic.users.login.success");
135135

136+
/** Signup business event */
137+
Address<String> SIGN_UP = new Address<>("server.business_logic.users.signup");
138+
136139
/** The Exec command being executed */
137140
Address<String> EXEC_CMD = new Address<>("server.sys.exec.cmd");
138141

@@ -215,6 +218,8 @@ static Address<?> forName(String name) {
215218
return LOGIN_SUCCESS;
216219
case "server.business_logic.users.login.failure":
217220
return LOGIN_FAILURE;
221+
case "server.business_logic.users.signup":
222+
return SIGN_UP;
218223
case "server.sys.exec.cmd":
219224
return EXEC_CMD;
220225
case "server.sys.shell.cmd":

dd-java-agent/appsec/src/main/java/com/datadog/appsec/gateway/GatewayBridge.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public class GatewayBridge {
7777
static {
7878
EVENT_MAPPINGS.put(LoginEvent.LOGIN_SUCCESS, KnownAddresses.LOGIN_SUCCESS);
7979
EVENT_MAPPINGS.put(LoginEvent.LOGIN_FAILURE, KnownAddresses.LOGIN_FAILURE);
80+
EVENT_MAPPINGS.put(LoginEvent.SIGN_UP, KnownAddresses.SIGN_UP);
8081
}
8182

8283
private static final String METASTRUCT_EXPLOIT = "exploit";

dd-java-agent/appsec/src/test/groovy/com/datadog/appsec/event/data/KnownAddressesSpecification.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class KnownAddressesSpecification extends Specification {
4040
'usr.session_id',
4141
'server.business_logic.users.login.failure',
4242
'server.business_logic.users.login.success',
43+
'server.business_logic.users.signup',
4344
'server.io.net.url',
4445
'server.io.fs.file',
4546
'server.sys.exec.cmd',
@@ -50,7 +51,7 @@ class KnownAddressesSpecification extends Specification {
5051

5152
void 'number of known addresses is expected number'() {
5253
expect:
53-
Address.instanceCount() == 38
54+
Address.instanceCount() == 39
5455
KnownAddresses.WAF_CONTEXT_PROCESSOR.serial == Address.instanceCount() - 1
5556
}
5657
}

dd-java-agent/appsec/src/test/groovy/com/datadog/appsec/gateway/GatewayBridgeSpecification.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,7 @@ class GatewayBridgeSpecification extends DDSpecification {
10821082
then:
10831083
1 * eventDispatcher.publishDataEvent(nonEmptyDsInfo, ctx.data, _ as DataBundle, _ as GatewayContext) >> { a, b, DataBundle db, GatewayContext gw ->
10841084
assert db.get(KnownAddresses.USER_LOGIN) == USER_ID
1085+
assert db.get(KnownAddresses.SIGN_UP) != null
10851086
assert !gw.isTransient
10861087
return NoopFlow.INSTANCE
10871088
}

dd-java-agent/instrumentation/akka-concurrent/src/main/java/datadog/trace/instrumentation/akka/concurrent/AkkaActorCellInstrumentation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static void enter(
8181
return;
8282
}
8383
// Create an active scope with a noop span, and clean all the way to the previous scope
84-
activateSpan(noopSpan(), false);
84+
activateSpan(noopSpan());
8585
}
8686

8787
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)

dd-java-agent/instrumentation/akka-concurrent/src/main/java/datadog/trace/instrumentation/akka/concurrent/AkkaMailboxInstrumentation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static void enter() {
7575
return;
7676
}
7777
// Create an active scope with a noop span, and clean all the way to the previous scope
78-
activateSpan(noopSpan(), false);
78+
activateSpan(noopSpan());
7979
}
8080

8181
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)

0 commit comments

Comments
 (0)