Skip to content

Commit 02c6bcc

Browse files
Merge branch 'master' into daniel.mohedano/instrumentation-test-handling-refactor
2 parents 9a320be + da6a1b6 commit 02c6bcc

File tree

674 files changed

+7552
-3704
lines changed

Some content is hidden

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

674 files changed

+7552
-3704
lines changed

.circleci/config.continue.yml.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ instrumentation_modules: &instrumentation_modules "dd-java-agent/instrumentation
3636
debugger_modules: &debugger_modules "dd-java-agent/agent-debugger|dd-java-agent/agent-bootstrap|dd-java-agent/agent-builder|internal-api|communication|dd-trace-core"
3737
profiling_modules: &profiling_modules "dd-java-agent/agent-profiling"
3838

39-
default_system_tests_commit: &default_system_tests_commit 315bc8a32cc888834726397f088336ba8038277f
39+
default_system_tests_commit: &default_system_tests_commit 0509dbd094c9cbf15f58db96f62276a0adff7efa
4040

4141
parameters:
4242
nightly:
@@ -857,6 +857,9 @@ jobs:
857857
APPSEC_REQUEST_BLOCKING
858858
APPSEC_RASP
859859
APPSEC_RUNTIME_ACTIVATION
860+
APPSEC_API_SECURITY
861+
APPSEC_API_SECURITY_RC
862+
APPSEC_API_SECURITY_WITH_SAMPLING
860863
APPSEC_WAF_TELEMETRY
861864
APPSEC_STANDALONE_V2
862865
IAST_STANDALONE_V2

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ dd-java-agent/instrumentation/spring-security-5/ @DataDog/asm-java
6565
# @DataDog/data-jobs-monitoring
6666
dd-java-agent/instrumentation/spark/ @DataDog/data-jobs-monitoring
6767
dd-java-agent/instrumentation/spark-executor/ @DataDog/data-jobs-monitoring
68+
69+
# @DataDog/data-streams-monitoring
70+
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/datastreams @DataDog/data-streams-monitoring
71+
dd-trace-core/src/main/java/datadog/trace/core/datastreams @DataDog/data-streams-monitoring
72+
dd-trace-core/src/test/groovy/datadog/trace/core/datastreams @DataDog/data-streams-monitoring
73+
internal-api/src/main/java/datadog/trace/api/datastreams @DataDog/data-streams-monitoring
74+
internal-api/src/test/groovy/datadog/trace/api/datastreams @DataDog/data-streams-monitoring

.github/workflows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ _Recovery:_ Check at the milestone for the related issues and update them manual
8787

8888
### prune-github-container-registry [🔗](prune-github-container-registry.yaml)
8989

90-
_Trigger:_ Every week or manually.
90+
_Trigger:_ Every day or manually.
9191

9292
_Action:_ Clean up old lib-injection OCI images from GitHub Container Registry.
9393

.github/workflows/prune-github-container-registry.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ jobs:
2323
keep-tags: |
2424
latest_snapshot
2525
prune-tags-regexes: |
26-
^[a-z0-9]{40}$
26+
^[a-z0-9]{40}(-arm64|-amd64)?$
2727
prune-untagged: true

.gitlab-ci.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ variables:
2424
BUILD_CACHE_POLICY: pull
2525
GRADLE_VERSION: "8.4" # must match gradle-wrapper.properties
2626
JAVA_BUILD_IMAGE_VERSION: "v25.01"
27+
REPO_NOTIFICATION_CHANNEL: "#apm-java-escalations"
2728

2829
default:
2930
tags: [ "arch:amd64" ]
@@ -116,10 +117,6 @@ test_published_artifacts:
116117
image: ghcr.io/datadog/dd-trace-java-docker-build:${JAVA_BUILD_IMAGE_VERSION}-7 # Needs Java7 for some tests
117118
stage: tests
118119
needs: [ build ]
119-
rules:
120-
- if: '$POPULATE_CACHE'
121-
when: never
122-
- when: on_success
123120
variables:
124121
BUILD_CACHE_TYPE: lib
125122
script:
@@ -144,10 +141,6 @@ muzzle:
144141
needs: [ build ]
145142
stage: tests
146143
parallel: 8
147-
rules:
148-
- if: '$POPULATE_CACHE'
149-
when: never
150-
- when: on_success
151144
variables:
152145
BUILD_CACHE_TYPE: test
153146
script:

dd-java-agent/agent-bootstrap/gradle.lockfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ org.ow2.asm:asm-analysis:7.2=jacocoAnt
133133
org.ow2.asm:asm-analysis:9.2=jmhRuntimeClasspath,testRuntimeClasspath
134134
org.ow2.asm:asm-analysis:9.4=spotbugs
135135
org.ow2.asm:asm-commons:7.2=jacocoAnt
136-
org.ow2.asm:asm-commons:9.2=jmhRuntimeClasspath,testRuntimeClasspath
137136
org.ow2.asm:asm-commons:9.4=spotbugs
137+
org.ow2.asm:asm-commons:9.7.1=jmhRuntimeClasspath,testRuntimeClasspath
138138
org.ow2.asm:asm-tree:7.2=jacocoAnt
139-
org.ow2.asm:asm-tree:9.2=jmhRuntimeClasspath,testRuntimeClasspath
140139
org.ow2.asm:asm-tree:9.4=spotbugs
140+
org.ow2.asm:asm-tree:9.7.1=jmhRuntimeClasspath,testRuntimeClasspath
141141
org.ow2.asm:asm-util:9.2=jmhRuntimeClasspath,testRuntimeClasspath
142142
org.ow2.asm:asm-util:9.4=spotbugs
143143
org.ow2.asm:asm:7.2=jacocoAnt
144144
org.ow2.asm:asm:9.0=jmh,jmhCompileClasspath
145-
org.ow2.asm:asm:9.2=jmhRuntimeClasspath,testRuntimeClasspath
146145
org.ow2.asm:asm:9.4=spotbugs
146+
org.ow2.asm:asm:9.7.1=jmhRuntimeClasspath,testRuntimeClasspath
147147
org.pitest:pitest-command-line:1.9.11=pitest
148148
org.pitest:pitest-entry:1.9.11=pitest
149149
org.pitest:pitest:1.9.11=pitest

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

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import datadog.trace.api.profiling.ProfilingEnablement;
3434
import datadog.trace.api.scopemanager.ScopeListener;
3535
import datadog.trace.bootstrap.benchmark.StaticEventLogger;
36+
import datadog.trace.bootstrap.config.provider.StableConfigSource;
3637
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
3738
import datadog.trace.bootstrap.instrumentation.api.AgentTracer.TracerAPI;
3839
import datadog.trace.bootstrap.instrumentation.api.ProfilingContextIntegration;
@@ -82,43 +83,39 @@ public class Agent {
8283
private static final Logger log;
8384

8485
private enum AgentFeature {
85-
TRACING(propertyNameToSystemPropertyName(TraceInstrumentationConfig.TRACE_ENABLED), true),
86-
JMXFETCH(propertyNameToSystemPropertyName(JmxFetchConfig.JMX_FETCH_ENABLED), true),
87-
STARTUP_LOGS(
88-
propertyNameToSystemPropertyName(GeneralConfig.STARTUP_LOGS_ENABLED),
89-
DEFAULT_STARTUP_LOGS_ENABLED),
90-
PROFILING(propertyNameToSystemPropertyName(ProfilingConfig.PROFILING_ENABLED), false),
91-
APPSEC(propertyNameToSystemPropertyName(AppSecConfig.APPSEC_ENABLED), false),
92-
IAST(propertyNameToSystemPropertyName(IastConfig.IAST_ENABLED), false),
93-
REMOTE_CONFIG(
94-
propertyNameToSystemPropertyName(RemoteConfigConfig.REMOTE_CONFIGURATION_ENABLED), true),
95-
DEPRECATED_REMOTE_CONFIG(
96-
propertyNameToSystemPropertyName(RemoteConfigConfig.REMOTE_CONFIG_ENABLED), true),
97-
CWS(propertyNameToSystemPropertyName(CwsConfig.CWS_ENABLED), false),
98-
CIVISIBILITY(propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_ENABLED), false),
99-
CIVISIBILITY_AGENTLESS(
100-
propertyNameToSystemPropertyName(CiVisibilityConfig.CIVISIBILITY_AGENTLESS_ENABLED), false),
101-
USM(propertyNameToSystemPropertyName(UsmConfig.USM_ENABLED), false),
102-
TELEMETRY(propertyNameToSystemPropertyName(GeneralConfig.TELEMETRY_ENABLED), true),
103-
DEBUGGER(
104-
propertyNameToSystemPropertyName(DebuggerConfig.DYNAMIC_INSTRUMENTATION_ENABLED), false),
105-
EXCEPTION_DEBUGGING(
106-
propertyNameToSystemPropertyName(DebuggerConfig.EXCEPTION_REPLAY_ENABLED), false),
107-
SPAN_ORIGIN(
108-
propertyNameToSystemPropertyName(TraceInstrumentationConfig.CODE_ORIGIN_FOR_SPANS_ENABLED),
109-
false),
110-
DATA_JOBS(propertyNameToSystemPropertyName(GeneralConfig.DATA_JOBS_ENABLED), false),
111-
AGENTLESS_LOG_SUBMISSION(
112-
propertyNameToSystemPropertyName(GeneralConfig.AGENTLESS_LOG_SUBMISSION_ENABLED), false);
113-
86+
TRACING(TraceInstrumentationConfig.TRACE_ENABLED, true),
87+
JMXFETCH(JmxFetchConfig.JMX_FETCH_ENABLED, true),
88+
STARTUP_LOGS(GeneralConfig.STARTUP_LOGS_ENABLED, DEFAULT_STARTUP_LOGS_ENABLED),
89+
PROFILING(ProfilingConfig.PROFILING_ENABLED, false),
90+
APPSEC(AppSecConfig.APPSEC_ENABLED, false),
91+
IAST(IastConfig.IAST_ENABLED, false),
92+
REMOTE_CONFIG(RemoteConfigConfig.REMOTE_CONFIGURATION_ENABLED, true),
93+
DEPRECATED_REMOTE_CONFIG(RemoteConfigConfig.REMOTE_CONFIG_ENABLED, true),
94+
CWS(CwsConfig.CWS_ENABLED, false),
95+
CIVISIBILITY(CiVisibilityConfig.CIVISIBILITY_ENABLED, false),
96+
CIVISIBILITY_AGENTLESS(CiVisibilityConfig.CIVISIBILITY_AGENTLESS_ENABLED, false),
97+
USM(UsmConfig.USM_ENABLED, false),
98+
TELEMETRY(GeneralConfig.TELEMETRY_ENABLED, true),
99+
DEBUGGER(DebuggerConfig.DYNAMIC_INSTRUMENTATION_ENABLED, false),
100+
EXCEPTION_DEBUGGING(DebuggerConfig.EXCEPTION_REPLAY_ENABLED, false),
101+
SPAN_ORIGIN(TraceInstrumentationConfig.CODE_ORIGIN_FOR_SPANS_ENABLED, false),
102+
DATA_JOBS(GeneralConfig.DATA_JOBS_ENABLED, false),
103+
AGENTLESS_LOG_SUBMISSION(GeneralConfig.AGENTLESS_LOG_SUBMISSION_ENABLED, false);
104+
105+
private final String configKey;
114106
private final String systemProp;
115107
private final boolean enabledByDefault;
116108

117-
AgentFeature(final String systemProp, final boolean enabledByDefault) {
118-
this.systemProp = systemProp;
109+
AgentFeature(final String configKey, final boolean enabledByDefault) {
110+
this.configKey = configKey;
111+
this.systemProp = propertyNameToSystemPropertyName(configKey);
119112
this.enabledByDefault = enabledByDefault;
120113
}
121114

115+
public String getConfigKey() {
116+
return configKey;
117+
}
118+
122119
public String getSystemProp() {
123120
return systemProp;
124121
}
@@ -1212,10 +1209,17 @@ private static boolean isDebugMode() {
12121209
/** @return {@code true} if the agent feature is enabled */
12131210
private static boolean isFeatureEnabled(AgentFeature feature) {
12141211
// must be kept in sync with logic from Config!
1215-
final String featureEnabledSysprop = feature.getSystemProp();
1216-
String featureEnabled = System.getProperty(featureEnabledSysprop);
1212+
final String featureConfigKey = feature.getConfigKey();
1213+
final String featureSystemProp = feature.getSystemProp();
1214+
String featureEnabled = System.getProperty(featureSystemProp);
1215+
if (featureEnabled == null) {
1216+
featureEnabled = getStableConfig(StableConfigSource.FLEET, featureConfigKey);
1217+
}
1218+
if (featureEnabled == null) {
1219+
featureEnabled = ddGetEnv(featureSystemProp);
1220+
}
12171221
if (featureEnabled == null) {
1218-
featureEnabled = ddGetEnv(featureEnabledSysprop);
1222+
featureEnabled = getStableConfig(StableConfigSource.LOCAL, featureConfigKey);
12191223
}
12201224

12211225
if (feature.isEnabledByDefault()) {
@@ -1235,11 +1239,17 @@ private static boolean isFeatureEnabled(AgentFeature feature) {
12351239
/** @see datadog.trace.api.ProductActivation#fromString(String) */
12361240
private static boolean isFullyDisabled(final AgentFeature feature) {
12371241
// must be kept in sync with logic from Config!
1238-
final String featureEnabledSysprop = feature.systemProp;
1239-
String settingValue = getNullIfEmpty(System.getProperty(featureEnabledSysprop));
1242+
final String featureConfigKey = feature.getConfigKey();
1243+
final String featureSystemProp = feature.getSystemProp();
1244+
String settingValue = getNullIfEmpty(System.getProperty(featureSystemProp));
12401245
if (settingValue == null) {
1241-
settingValue = getNullIfEmpty(ddGetEnv(featureEnabledSysprop));
1242-
settingValue = settingValue != null && settingValue.isEmpty() ? null : settingValue;
1246+
settingValue = getNullIfEmpty(getStableConfig(StableConfigSource.FLEET, featureConfigKey));
1247+
}
1248+
if (settingValue == null) {
1249+
settingValue = getNullIfEmpty(ddGetEnv(featureSystemProp));
1250+
}
1251+
if (settingValue == null) {
1252+
settingValue = getNullIfEmpty(getStableConfig(StableConfigSource.LOCAL, featureConfigKey));
12431253
}
12441254

12451255
// defaults to inactive
@@ -1353,6 +1363,11 @@ private static String ddGetProperty(final String sysProp) {
13531363
return value;
13541364
}
13551365

1366+
/** Looks for sysProp in the Stable Configuration input */
1367+
private static String getStableConfig(StableConfigSource source, final String sysProp) {
1368+
return source.get(sysProp);
1369+
}
1370+
13561371
/** Looks for the "DD_" environment variable equivalent of the given "dd." system property. */
13571372
private static String ddGetEnv(final String sysProp) {
13581373
return System.getenv(toEnvVar(sysProp));

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
142142
if (null != prefixRoot) {
143143
String entryKey = computeEntryKey(prefixRoot.relativize(file));
144144
if (null != entryKey) {
145+
int existingPrefixId = prefixTrie.apply(entryKey);
146+
if (-1 != existingPrefixId && prefixId != existingPrefixId) {
147+
log.warn(
148+
"Detected duplicate content under '{}'. Ensure your content is under a distinct directory.",
149+
entryKey);
150+
}
145151
prefixTrie.put(entryKey, prefixId);
146152
if (entryKey.endsWith("*")) {
147153
// optimization: wildcard will match everything under here so can skip

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package datadog.trace.bootstrap.instrumentation.decorator;
22

33
import static datadog.trace.api.cache.RadixTreeCache.UNSET_STATUS;
4+
import static datadog.trace.api.datastreams.DataStreamsContext.fromTags;
45
import static datadog.trace.api.gateway.Events.EVENTS;
6+
import static datadog.trace.bootstrap.instrumentation.api.AgentPropagation.extractContextAndGetSpanContext;
57
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.traceConfig;
68
import static datadog.trace.bootstrap.instrumentation.decorator.http.HttpResourceDecorator.HTTP_RESOURCE_DECORATOR;
79

@@ -127,7 +129,7 @@ public AgentSpanContext.Extracted extract(REQUEST_CARRIER carrier) {
127129
if (null == carrier || null == getter) {
128130
return null;
129131
}
130-
return tracer().propagate().extract(carrier, getter);
132+
return extractContextAndGetSpanContext(carrier, getter);
131133
}
132134

133135
/** Deprecated. Use {@link #startSpan(String, Object, AgentSpanContext.Extracted)} instead. */
@@ -148,7 +150,7 @@ public AgentSpan startSpan(
148150
}
149151
AgentPropagation.ContextVisitor<REQUEST_CARRIER> getter = getter();
150152
if (null != carrier && null != getter) {
151-
tracer().getDataStreamsMonitoring().setCheckpoint(span, SERVER_PATHWAY_EDGE_TAGS, 0, 0);
153+
tracer().getDataStreamsMonitoring().setCheckpoint(span, fromTags(SERVER_PATHWAY_EDGE_TAGS));
152154
}
153155
return span;
154156
}

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/httpurlconnection/HeadersInjectAdapter.java

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

3-
import datadog.trace.bootstrap.instrumentation.api.AgentPropagation;
3+
import datadog.context.propagation.CarrierSetter;
44
import java.net.HttpURLConnection;
55
import javax.annotation.ParametersAreNonnullByDefault;
66

77
@ParametersAreNonnullByDefault
8-
public class HeadersInjectAdapter implements AgentPropagation.Setter<HttpURLConnection> {
8+
public class HeadersInjectAdapter implements CarrierSetter<HttpURLConnection> {
99

1010
public static final HeadersInjectAdapter SETTER = new HeadersInjectAdapter();
1111

0 commit comments

Comments
 (0)