Skip to content

Commit 635a97f

Browse files
authored
Merge branch 'master' into alejandro.gonzalez/APPSEC-61873-5-jersey-resteasy
2 parents 8bec00f + c72f067 commit 635a97f

82 files changed

Lines changed: 7051 additions & 273 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.

.github/workflows/analyze-changes.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
submodules: 'recursive'
2222
- name: Cache Gradle dependencies
23-
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
23+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
2424
with:
2525
path: |
2626
~/.gradle/caches
@@ -30,7 +30,7 @@ jobs:
3030
${{ runner.os }}-gradle-
3131
3232
- name: Initialize CodeQL
33-
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
33+
uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
3434
with:
3535
languages: 'java'
3636
build-mode: 'manual'
@@ -43,7 +43,7 @@ jobs:
4343
./gradlew clean :dd-java-agent:shadowJar --build-cache --parallel --stacktrace --no-daemon --max-workers=4
4444
4545
- name: Perform CodeQL Analysis and upload results to GitHub Security tab
46-
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
46+
uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
4747

4848
trivy:
4949
name: Analyze changes with Trivy
@@ -60,7 +60,7 @@ jobs:
6060
submodules: 'recursive'
6161

6262
- name: Cache Gradle dependencies
63-
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
63+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6464
with:
6565
path: |
6666
~/.gradle/caches
@@ -102,7 +102,7 @@ jobs:
102102
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db
103103

104104
- name: Upload Trivy scan results to GitHub Security tab
105-
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
105+
uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
106106
if: always()
107107
with:
108108
sarif_file: 'trivy-results.sarif'

.github/workflows/run-system-tests.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fetch-depth: 0
3131

3232
- name: Cache Gradle dependencies
33-
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
33+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
3434
with:
3535
path: |
3636
~/.gradle/caches
@@ -76,7 +76,10 @@ jobs:
7676
scenarios_groups: tracer-release
7777
excluded_scenarios: APM_TRACING_E2E_OTEL,APM_TRACING_E2E_SINGLE_SPAN,PROFILING # exclude flaky scenarios
7878
skip_empty_scenarios: true
79-
push_to_test_optimization: false # disabled to avoid pushing to Test Optimization while API key is transitioning to system-tests
79+
push_to_test_optimization: true
80+
secrets:
81+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
82+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
8083

8184
# Ensure the main job is run to completion
8285
check:

.gitlab-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ include:
44
- local: ".gitlab/macrobenchmarks.yml"
55
- local: ".gitlab/exploration-tests.yml"
66
- local: ".gitlab/ci-visibility-tests.yml"
7+
- project: 'DataDog/apm-reliability/apm-sdks-benchmarks'
8+
file: '.gitlab/ci-java-spring-petclinic-parallel.yml'
9+
ref: 'main'
710

811
stages:
912
- build
1013
- publish
14+
# These benchmarks are intended to replace the legacy benchmarks in the future
15+
- java-spring-petclinic-parallel
16+
- java-spring-petclinic-parallel-slo
1117
- shared-pipeline
1218
- benchmarks
1319
- macrobenchmarks

dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ public int offsetOf(String attribute) {
353353
return contextSetter.offsetOf(attribute);
354354
}
355355

356-
public void setSpanContext(long spanId, long rootSpanId) {
356+
public void setSpanContext(long rootSpanId, long spanId, long traceIdHigh, long traceIdLow) {
357357
debugLogging(rootSpanId);
358358
try {
359-
profiler.setContext(spanId, rootSpanId);
359+
profiler.setContext(rootSpanId, spanId, traceIdHigh, traceIdLow);
360360
} catch (Throwable e) {
361361
log.debug("Failed to clear context", e);
362362
}
@@ -365,28 +365,16 @@ public void setSpanContext(long spanId, long rootSpanId) {
365365
public void clearSpanContext() {
366366
debugLogging(0L);
367367
try {
368-
profiler.setContext(0L, 0L);
368+
profiler.setContext(0L, 0L, 0L, 0L);
369369
} catch (Throwable e) {
370370
log.debug("Failed to set context", e);
371371
}
372372
}
373373

374-
public boolean setContextValue(int offset, int encoding) {
375-
if (contextSetter != null && offset >= 0) {
376-
try {
377-
return contextSetter.setContextValue(offset, encoding);
378-
} catch (Throwable e) {
379-
log.debug("Failed to set context", e);
380-
}
381-
}
382-
return false;
383-
}
384-
385374
public boolean setContextValue(int offset, CharSequence value) {
386-
if (contextSetter != null && offset >= 0) {
387-
int encoding = encode(value);
375+
if (contextSetter != null && offset >= 0 && value != null) {
388376
try {
389-
return contextSetter.setContextValue(offset, encoding);
377+
return contextSetter.setContextValue(offset, value.toString());
390378
} catch (Throwable e) {
391379
log.debug("Failed to set context", e);
392380
}
@@ -425,13 +413,6 @@ private void debugLogging(long localRootSpanId) {
425413
}
426414
}
427415

428-
int encode(CharSequence constant) {
429-
if (constant != null && profiler != null) {
430-
return contextSetter.encode(constant.toString());
431-
}
432-
return 0;
433-
}
434-
435416
public int[] snapshot() {
436417
if (contextSetter != null) {
437418
return contextSetter.snapshotTags();

dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfilingIntegration.java

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ public void close() {
4141
public void activate(Object context) {
4242
if (context instanceof ProfilerContext) {
4343
ProfilerContext profilerContext = (ProfilerContext) context;
44-
DDPROF.setSpanContext(profilerContext.getSpanId(), profilerContext.getRootSpanId());
45-
DDPROF.setContextValue(SPAN_NAME_INDEX, profilerContext.getEncodedOperationName());
46-
DDPROF.setContextValue(RESOURCE_NAME_INDEX, profilerContext.getEncodedResourceName());
44+
DDPROF.setSpanContext(
45+
profilerContext.getRootSpanId(),
46+
profilerContext.getSpanId(),
47+
profilerContext.getTraceIdHigh(),
48+
profilerContext.getTraceIdLow());
49+
DDPROF.setContextValue(SPAN_NAME_INDEX, profilerContext.getOperationName());
50+
DDPROF.setContextValue(RESOURCE_NAME_INDEX, profilerContext.getResourceName());
4751
}
4852
}
4953
};
@@ -67,27 +71,6 @@ public void onDetach() {
6771
}
6872
}
6973

70-
@Override
71-
public int encode(CharSequence constant) {
72-
return DDPROF.encode(constant);
73-
}
74-
75-
@Override
76-
public int encodeOperationName(CharSequence constant) {
77-
if (SPAN_NAME_INDEX >= 0) {
78-
return DDPROF.encode(constant);
79-
}
80-
return 0;
81-
}
82-
83-
@Override
84-
public int encodeResourceName(CharSequence constant) {
85-
if (RESOURCE_NAME_INDEX >= 0) {
86-
return DDPROF.encode(constant);
87-
}
88-
return 0;
89-
}
90-
9174
@Override
9275
public String name() {
9376
return "ddprof";

dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfilingScope.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55

66
public class DatadogProfilingScope implements ProfilingScope {
77
private final DatadogProfiler profiler;
8-
private final int[] snapshot;
98

109
public DatadogProfilingScope(DatadogProfiler profiler) {
1110
this.profiler = profiler;
12-
this.snapshot = profiler.snapshot();
1311
}
1412

1513
@Override
@@ -38,8 +36,7 @@ public void clearContextValue(ProfilingContextAttribute attribute) {
3836

3937
@Override
4038
public void close() {
41-
for (int i = 0; i < snapshot.length; i++) {
42-
profiler.setContextValue(i, snapshot[i]);
43-
}
39+
// ddprof 1.41.0 removed the int-encoding setter; snapshot/restore of tag
40+
// context across nested scopes is no longer supported by the library.
4441
}
4542
}

dd-java-agent/agent-profiling/profiling-ddprof/src/test/java/com/datadog/profiling/ddprof/DatadogProfilerTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.datadog.profiling.ddprof;
22

3-
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
43
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
54
import static org.junit.jupiter.api.Assertions.assertFalse;
65
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -180,7 +179,6 @@ public void testContextRegistration() {
180179

181180
DatadogProfilerContextSetter fooSetter = new DatadogProfilerContextSetter("foo", profiler);
182181
DatadogProfilerContextSetter barSetter = new DatadogProfilerContextSetter("bar", profiler);
183-
int[] snapshot0 = profiler.snapshot();
184182
try (ProfilingScope ignored = new DatadogProfilingScope(profiler)) {
185183
fooSetter.set("foo0");
186184
barSetter.set("bar0");
@@ -194,9 +192,7 @@ public void testContextRegistration() {
194192
inner.setContextValue("bar", "bar2");
195193
assertFalse(Arrays.equals(snapshot2, profiler.snapshot()));
196194
}
197-
assertArrayEquals(snapshot1, profiler.snapshot());
198195
}
199-
assertArrayEquals(snapshot0, profiler.snapshot());
200196
}
201197

202198
private static ConfigProvider configProvider(

dd-java-agent/appsec/src/main/java/com/datadog/appsec/config/AppSecConfigServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ public void maybeSubscribeConfigPolling() {
422422
} else {
423423
subscribeConfigurationPoller();
424424
}
425-
} else {
425+
} else if (!tracerConfig.isAwsServerless()) {
426426
log.info("Remote config is disabled; AppSec will not be able to use it");
427427
}
428428
}

dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
11701170
}
11711171

11721172
response.body().contentLength() < 1 || redirectHasBody()
1173+
response.close()
11731174

11741175
and:
11751176
assertTraces(1) {
@@ -1210,6 +1211,8 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
12101211
if (bubblesResponse()) {
12111212
assert response.body().string().contains(ERROR.body)
12121213
assert response.code() == ERROR.status
1214+
} else {
1215+
response.close()
12131216
}
12141217

12151218
and:
@@ -1255,6 +1258,8 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
12551258
response.code() == EXCEPTION.status
12561259
if (testExceptionBody()) {
12571260
assert response.body().string() == EXCEPTION.body
1261+
} else {
1262+
response.close()
12581263
}
12591264

12601265
and:
@@ -1299,6 +1304,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
12991304

13001305
expect:
13011306
response.code() == NOT_FOUND.status
1307+
response.close()
13021308

13031309
and:
13041310
assertTraces(1) {
@@ -1836,6 +1842,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
18361842
response.code() == 301
18371843
response.header('location') == 'https://www.google.com/'
18381844
!handlerRan
1845+
response.close()
18391846

18401847
when:
18411848
TEST_WRITER.waitForTraces(1)
@@ -2117,6 +2124,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
21172124
}
21182125
response.code() == 301
21192126
response.header("Location") == 'https://www.google.com/'
2127+
response.close()
21202128
TEST_WRITER.waitForTraces(1)
21212129
def trace = TEST_WRITER.get(0)
21222130

0 commit comments

Comments
 (0)