Skip to content

Commit 7cd016e

Browse files
authored
Merge branch 'master' into andrea.marziali/crashtracking
2 parents 2b71c78 + b4aebf8 commit 7cd016e

File tree

126 files changed

+3583
-725
lines changed

Some content is hidden

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

126 files changed

+3583
-725
lines changed

.circleci/config.continue.yml.j2

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,14 @@ commands:
179179
display_memory_usage:
180180
steps:
181181
- run:
182-
name: Max Memory Used
182+
name: Runner Memory Usage
183183
# The file does not seem to exist when DLC is disabled
184-
command: cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes || true
184+
command: |
185+
# Show cgroupv2 memory usage
186+
printf "cgroup memory.peak: $(cat /sys/fs/cgroup/memory.peak 2>/dev/null || echo 'not found')%s\n"
187+
printf "cgroup memory.max : $(cat /sys/fs/cgroup/memory.max 2>/dev/null || echo 'not found')%s\n"
188+
printf "cgroup memory.high: $(cat /sys/fs/cgroup/memory.high 2>/dev/null || echo 'not found')%s\n"
189+
printf "ram memory : $(grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f 2)%s\n"
185190
when: always
186191

187192

@@ -282,9 +287,11 @@ commands:
282287
jobs:
283288
build:
284289
<<: *defaults
285-
resource_class: xlarge
286290

287291
parameters:
292+
resourceClass:
293+
type: string
294+
default: xlarge
288295
gradleTarget:
289296
type: string
290297
cacheType:
@@ -296,6 +303,7 @@ jobs:
296303
type: string
297304
default: ".*"
298305

306+
resource_class: << parameters.resourceClass >>
299307
steps:
300308
- setup_code
301309

@@ -304,15 +312,15 @@ jobs:
304312

305313
- restore_dependency_cache:
306314
cacheType: << parameters.cacheType >>
307-
315+
308316
- run:
309317
name: Build Project
310318
command: >-
311319
{% if is_nightly %}
312-
./gradlew resolveAndLockAll --write-locks &&
320+
./gradlew resolveAndLockAll --write-locks --no-daemon &&
313321
{% endif %}
314322
MAVEN_OPTS="-Xms64M -Xmx256M"
315-
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2560M -Xms2560M -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
323+
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx2560M -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
316324
./gradlew clean
317325
<< parameters.gradleTarget >>
318326
-PskipTests
@@ -384,6 +392,9 @@ jobs:
384392
<<: *defaults
385393

386394
parameters:
395+
resourceClass:
396+
type: string
397+
default: medium+
387398
parallelism:
388399
type: integer
389400
default: 1
@@ -395,7 +406,7 @@ jobs:
395406
type: string
396407
default: ".*"
397408

398-
resource_class: medium+
409+
resource_class: << parameters.resourceClass >>
399410

400411
parallelism: << parameters.parallelism >>
401412

@@ -445,6 +456,8 @@ jobs:
445456
when: on_fail
446457
command: .circleci/cancel_workflow.sh
447458

459+
- display_memory_usage
460+
448461
build_clean_cache:
449462
<<: *defaults
450463

@@ -493,13 +506,13 @@ jobs:
493506

494507
tests: &tests
495508
<<: *defaults
496-
# since tests use test containers, they will use a Linux VM / Remote Docker executor, so there is no medium+ size
497-
resource_class: large
498-
499509
docker:
500510
- image: << pipeline.parameters.docker_image >>:{{ docker_image_prefix }}<< parameters.testJvm >>
501511

502512
parameters:
513+
resourceClass:
514+
type: string
515+
default: large
503516
environment:
504517
type: string
505518
default: ""
@@ -535,6 +548,9 @@ jobs:
535548
cacheType:
536549
type: string
537550

551+
# since tests use test containers, they will use a Linux VM / Remote Docker executor, so there is no medium+ size
552+
resource_class: << parameters.resourceClass >>
553+
538554
parallelism: << parameters.parallelism >>
539555

540556
steps:
@@ -652,13 +668,18 @@ jobs:
652668
exit 1
653669
fi
654670

671+
# TODO: merge xlarge_tests and tests? or rename this?
655672
xlarge_tests:
656673
<<: *tests
657674

658675
docker:
676+
# The first image listed in your configuration for a job is referred to as the primary container image
677+
# and this is where all steps in the job will run. Secondary containers can also be specified to run
678+
# alongside for running services, such as, databases.
659679
- image: << pipeline.parameters.docker_image >>:{{ docker_image_prefix }}<< parameters.testJvm >>
660680
environment:
661681
- CI_USE_TEST_AGENT=true
682+
662683
- image: ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.11.0
663684
environment:
664685
- LOG_LEVEL=DEBUG
@@ -667,8 +688,6 @@ jobs:
667688
- DD_POOL_TRACE_CHECK_FAILURES=true
668689
- DD_DISABLE_ERROR_RESPONSES=true
669690
- ENABLED_CHECKS=trace_content_length,trace_stall,meta_tracer_version_header,trace_count_header,trace_peer_service,trace_dd_service
670-
# TODO: merge xlarge_tests and tests? or rename this?
671-
resource_class: large
672691

673692

674693
# The only way to do fan-in in CircleCI seems to have a proper job, so let's have one that
@@ -969,15 +988,18 @@ build_test_jobs: &build_test_jobs
969988
cacheType: base
970989
- build:
971990
name: build_inst
991+
resourceClass: 2xlarge
972992
gradleTarget: :instrumentationTest
973993
cacheType: inst
974994
triggeredBy: *instrumentation_modules
975995
- build:
976996
name: build_latestdep
997+
resourceClass: 2xlarge
977998
gradleTarget: :instrumentationLatestDepTest
978999
cacheType: latestdep
9791000
- build:
9801001
name: build_smoke
1002+
resourceClass: 2xlarge
9811003
gradleTarget: :smokeTest
9821004
cacheType: smoke
9831005
- build:
@@ -1001,13 +1023,15 @@ build_test_jobs: &build_test_jobs
10011023
requires:
10021024
- ok_to_test
10031025
name: check_base
1026+
resourceClass: large
10041027
gradleTarget: ":baseCheck"
10051028
cacheType: base
10061029

10071030
- check:
10081031
requires:
10091032
- ok_to_test
10101033
name: check_inst
1034+
resourceClass: 2xlarge
10111035
parallelism: 5
10121036
gradleTarget: ":instrumentationCheck"
10131037
cacheType: inst
@@ -1017,6 +1041,7 @@ build_test_jobs: &build_test_jobs
10171041
requires:
10181042
- ok_to_test
10191043
name: check_smoke
1044+
resourceClass: large
10201045
gradleTarget: ":smokeCheck"
10211046
cacheType: smoke
10221047

@@ -1075,6 +1100,7 @@ build_test_jobs: &build_test_jobs
10751100
requires:
10761101
- ok_to_test
10771102
name: z_test_<< matrix.testJvm >>_inst
1103+
resourceClass: xlarge
10781104
gradleTarget: ":instrumentationTest"
10791105
gradleParameters: "-PskipFlakyTests"
10801106
triggeredBy: *instrumentation_modules
@@ -1103,6 +1129,7 @@ build_test_jobs: &build_test_jobs
11031129
- ok_to_test
11041130
- build_latestdep
11051131
name: test_8_inst_latest
1132+
resourceClass: xlarge
11061133
gradleTarget: ":instrumentationLatestDepTest"
11071134
gradleParameters: "-PskipFlakyTests"
11081135
triggeredBy: *instrumentation_modules
@@ -1117,6 +1144,7 @@ build_test_jobs: &build_test_jobs
11171144
- ok_to_test
11181145
- build_latestdep
11191146
name: test_17_inst_latest
1147+
resourceClass: xlarge
11201148
gradleTarget: ":instrumentationLatestDepTest"
11211149
gradleParameters: "-PskipFlakyTests"
11221150
triggeredBy: *instrumentation_modules
@@ -1304,6 +1332,7 @@ build_test_jobs: &build_test_jobs
13041332
requires:
13051333
- ok_to_test
13061334
name: z_test_8_smoke
1335+
resourceClass: xlarge
13071336
gradleTarget: "stageMainDist :smokeTest"
13081337
gradleParameters: "-PskipFlakyTests"
13091338
stage: smoke

.github/workflows/analyze-changes.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
${{ runner.os }}-gradle-
4141
4242
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
43+
uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
4444
with:
4545
languages: 'java'
4646
build-mode: 'manual'
@@ -57,7 +57,7 @@ jobs:
5757
--build-cache --parallel --stacktrace --no-daemon --max-workers=4
5858
5959
- name: Perform CodeQL Analysis and upload results to GitHub Security tab
60-
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
60+
uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
6161

6262
trivy:
6363
name: Analyze changes with Trivy
@@ -120,7 +120,7 @@ jobs:
120120
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db
121121

122122
- name: Upload Trivy scan results to GitHub Security tab
123-
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
123+
uses: github/codeql-action/upload-sarif@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
124124
if: always()
125125
with:
126126
sarif_file: 'trivy-results.sarif'

.github/workflows/check-ci-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ permissions:
1717

1818
jobs:
1919
check-ci-pipelines:
20-
name: Check CI Pipelines
20+
# Do not change this name, it must be equal to job id
21+
# https://github.com/DataDog/ensure-ci-success/blob/main/docs/limitations.md#do-not-set-a-name-to-the-job-shipping-ensure-ci-success
22+
name: check-ci-pipelines
2123
runs-on: ubuntu-latest
2224
steps:
2325
- name: Run Ensure CI Success
24-
uses: DataDog/ensure-ci-success@f40e6ffd8e60280d478b9b92209aaa30d3d56895
26+
uses: DataDog/ensure-ci-success@727e7fe39ae2e1ce7ea336ec85a7369ab0731754
2527
with:
2628
initial-delay-seconds: "1000"
2729
max-retries: "60"

.github/workflows/update-docker-build-image.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
sed -i 's|DOCKER_IMAGE_VERSION=.*|DOCKER_IMAGE_VERSION="${{ steps.define-tag.outputs.tag }}"|' .circleci/render_config.py
5656
- name: Update the Docker build image in GitLab CI config
5757
run: |
58-
sed -i 's|image: ghcr.io/datadog/dd-trace-java-docker-build:.*|image: ghcr.io/datadog/dd-trace-java-docker-build:${{ steps.define-tag.outputs.tag }}-base|' .gitlab-ci.yml
58+
sed -i 's|JAVA_BUILD_IMAGE_VERSION:.*|JAVA_BUILD_IMAGE_VERSION:"${{ steps.define-tag.outputs.tag }}"|' .gitlab-ci.yml
5959
- name: Commit and push changes
6060
env:
6161
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitlab-ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
include:
2-
- remote: https://gitlab-templates.ddbuild.io/libdatadog/include/ci_authenticated_job.yml
3-
- remote: https://gitlab-templates.ddbuild.io/libdatadog/include/one-pipeline.yml
2+
- project: DataDog/apm-reliability/libdatadog-build
3+
ref: 0f677257308e1c379af490b754febfb40fa2c06d
4+
file: templates/ci_authenticated_job.yml
5+
- local: ".gitlab/one-pipeline.locked.yml"
46
- local: ".gitlab/benchmarks.yml"
57
- local: ".gitlab/macrobenchmarks.yml"
68
- local: ".gitlab/exploration-tests.yml"
@@ -394,7 +396,7 @@ muzzle-dep-report:
394396
- if: $CI_COMMIT_BRANCH == "master"
395397
when: on_success
396398
script:
397-
- >
399+
- >
398400
if [ "$PROFILE_TESTS" == "true" ] && [ "$testJvm" != "ibm8" ] && [ "$testJvm" != "oracle8" ];
399401
then
400402
export PROFILER_COMMAND="-XX:StartFlightRecording=settings=profile,filename=/tmp/${CI_JOB_NAME_SLUG}.jfr,dumponexit=true";
@@ -799,4 +801,4 @@ tracer-base-image-snapshot:
799801
- echo $GH_TOKEN|docker login ghcr.io/datadog -u uploader --password-stdin
800802
- mkdir -p ./tooling/ci/binaries/ && cp workspace/dd-java-agent/build/libs/*.jar ./tooling/ci/binaries/dd-java-agent.jar
801803
- docker buildx build -t ghcr.io/datadog/dd-trace-java/dd-trace-java:latest_snapshot -f ./tooling/ci/Dockerfile .
802-
- docker push ghcr.io/datadog/dd-trace-java/dd-trace-java:latest_snapshot
804+
- docker push ghcr.io/datadog/dd-trace-java/dd-trace-java:latest_snapshot

.gitlab/one-pipeline.locked.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# DO NOT EDIT THIS FILE MANUALLY
2+
# This file is auto-generated by automation.
3+
include:
4+
- remote: https://gitlab-templates.ddbuild.io/libdatadog/one-pipeline/ca/05e116339b9780a138a474d0348e97debfca97f27bbc4ca489cf4e4c90d9cc94/one-pipeline.yml

components/json/src/main/java/datadog/json/JsonMapper.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
package datadog.json;
22

3+
import static java.util.Collections.emptyList;
4+
import static java.util.Collections.emptyMap;
5+
6+
import java.io.IOException;
7+
import java.util.ArrayList;
38
import java.util.Collection;
9+
import java.util.List;
410
import java.util.Map;
511

612
/** Utility class for simple Java structure mapping into JSON strings. */
@@ -103,4 +109,47 @@ public static String toJson(String[] items) {
103109
return writer.toString();
104110
}
105111
}
112+
113+
/**
114+
* Parses a JSON string into a {@link Map}.
115+
*
116+
* @param json The JSON string to parse.
117+
* @return A {@link Map} containing the parsed JSON object's key-value pairs.
118+
* @throws IOException If the JSON is invalid or a reader error occurs.
119+
*/
120+
@SuppressWarnings("unchecked")
121+
public static Map<String, Object> fromJsonToMap(String json) throws IOException {
122+
if (json == null || json.isEmpty() || "{}".equals(json) || "null".equals(json)) {
123+
return emptyMap();
124+
}
125+
try (JsonReader reader = new JsonReader(json)) {
126+
Object value = reader.nextValue();
127+
if (!(value instanceof Map)) {
128+
throw new IOException("Expected JSON object but was " + value.getClass().getSimpleName());
129+
}
130+
return (Map<String, Object>) value;
131+
}
132+
}
133+
134+
/**
135+
* Parses a JSON string array into a {@link List<String>}.
136+
*
137+
* @param json The JSON string array to parse.
138+
* @return A {@link List<String>} containing the parsed JSON strings.
139+
* @throws IOException If the JSON is invalid or a reader error occurs.
140+
*/
141+
public static List<String> fromJsonToList(String json) throws IOException {
142+
if (json == null || json.isEmpty() || "[]".equals(json) || "null".equals(json)) {
143+
return emptyList();
144+
}
145+
try (JsonReader reader = new JsonReader(json)) {
146+
List<String> list = new ArrayList<>();
147+
reader.beginArray();
148+
while (reader.hasNext()) {
149+
list.add(reader.nextString());
150+
}
151+
reader.endArray();
152+
return list;
153+
}
154+
}
106155
}

0 commit comments

Comments
 (0)