Skip to content

Commit 4d6a29c

Browse files
authored
Merge branch 'master' into sarahchen6/test-26-rc
2 parents 00719a6 + 4789e89 commit 4d6a29c

88 files changed

Lines changed: 4922 additions & 2825 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.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: migrate-groovy-to-java
3+
description: migrate test groovy files to java
4+
---
5+
6+
Migrate test Groovy files to Java using JUnit 5
7+
8+
1. List all groovy files of the current gradle module
9+
2. convert groovy files to Java using Junit 5
10+
3. make sure the tests are still passing after migration
11+
4. remove groovy files
12+
13+
When converting groovy code to java code make sure that:
14+
- the Java code generated is compatible with JDK 8
15+
- when translating Spock test, favor using `@CsvSource` with `|` delimiters
16+
- when using a `@MethodSource`, use the test method name, and suffix it with `_arguments`
17+
- when converting tuples, create light dedicated structure instead to keep the typing system
18+
- Instead of checking a state and throwing an exception, use JUnit asserts
19+
- Do not wrap checked exception and throwing a Runtime exception, prefer adding a throws clause at method declaration
20+
- Do not mark local variables `final`

.github/chainguard/self.enforce-datadog-merge-queue.comment-pr.sts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ subject: repo:DataDog/dd-trace-java:pull_request
44

55
claim_pattern:
66
event_name: pull_request
7-
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/enforce-datadog-merge-queue\.yaml@refs/heads/master
7+
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/enforce-datadog-merge-queue\.yaml@refs/pull/[0-9]+/merge
88

99
permissions:
1010
issues: write

.github/chainguard/self.pin-system-tests.create-pr.sts.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
issuer: https://token.actions.githubusercontent.com
22

3-
subject_pattern: repo:DataDog/dd-trace-java:ref:refs/heads/(master|release/v.+)
3+
subject_pattern: repo:DataDog/dd-trace-java:ref:refs/(heads/master|tags/v\d+\.\d+\.0)
44

55
claim_pattern:
6-
event_name: (create|workflow_dispatch)
7-
ref: refs/heads/(master|release/v.+)
8-
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/pin-system-tests\.yaml@refs/heads/(master|release/v.+)
6+
event_name: (workflow_dispatch|push)
7+
ref: refs/(heads/master|tags/v\d+\.\d+\.0)
8+
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/create-release-branch\.yaml@refs/heads/master
99

1010
permissions:
1111
contents: write

.github/workflows/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ This redirects GitHub's "Merge when ready" button to the Datadog merge queue sys
5353

5454
_Trigger:_ When a git tag matching the pattern "vM.N.0" is pushed (e.g. for a minor release).
5555

56-
_Action:_ Create a release branch that corresponds to the pushed tag (e.g. "release/vM.N.x").
56+
_Action:_ Create a release branch that corresponds to the pushed tag (e.g. "release/vM.N.x"). Then open a PR against the release branch that pins system tests.
5757

58-
_Recovery:_ Manually create the branch from the "vM.N.0" git tag.
58+
_Recovery:_ Manually create the release branch from the "vM.N.0" git tag, and pin system tests to this branch by running the `./tooling/update_system_test_reference.sh` script.
5959

6060
### draft-release-notes-on-tag [🔗](draft-release-notes-on-tag.yaml)
6161

.github/workflows/create-release-branch.yaml

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
runs-on: ubuntu-latest
1717
permissions:
1818
contents: write # Allow pushing the release branch
19+
outputs:
20+
release-branch-name: ${{ steps.define-release-branch.outputs.branch }}
1921
steps:
2022
- name: Determine tag
2123
id: determine-tag
@@ -31,8 +33,8 @@ jobs:
3133
fi
3234
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
3335
34-
- name: Define branch name from tag
35-
id: define-branch
36+
- name: Define release branch name from tag
37+
id: define-release-branch
3638
run: |
3739
TAG=${{ steps.determine-tag.outputs.tag }}
3840
echo "branch=release/${TAG%.0}.x" >> "$GITHUB_OUTPUT"
@@ -43,9 +45,9 @@ jobs:
4345
ref: ${{ steps.determine-tag.outputs.tag }}
4446

4547
- name: Check if branch already exists
46-
id: check-branch
48+
id: check-release-branch
4749
run: |
48-
BRANCH=${{ steps.define-branch.outputs.branch }}
50+
BRANCH=${{ steps.define-release-branch.outputs.branch }}
4951
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
5052
echo "creating_new_branch=false" >> "$GITHUB_OUTPUT"
5153
echo "Branch $BRANCH already exists - skipping creation"
@@ -55,7 +57,88 @@ jobs:
5557
fi
5658
5759
- name: Create and push release branch
58-
if: steps.check-branch.outputs.creating_new_branch == 'true'
60+
if: steps.check-release-branch.outputs.creating_new_branch == 'true'
5961
run: |
60-
git checkout -b "${{ steps.define-branch.outputs.branch }}"
61-
git push -u origin "${{ steps.define-branch.outputs.branch }}"
62+
git checkout -b "${{ steps.define-release-branch.outputs.branch }}"
63+
git push -u origin "${{ steps.define-release-branch.outputs.branch }}"
64+
65+
pin-system-tests:
66+
needs: create-release-branch
67+
runs-on: ubuntu-latest
68+
permissions:
69+
contents: write
70+
id-token: write # required for OIDC token federation
71+
steps:
72+
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
73+
id: octo-sts
74+
with:
75+
scope: DataDog/dd-trace-java
76+
policy: self.pin-system-tests.create-pr
77+
78+
- name: Checkout dd-trace-java at release branch
79+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
80+
with:
81+
ref: ${{ needs.create-release-branch.outputs.release-branch-name }}
82+
83+
- name: Get latest commit SHA of base release branch
84+
id: get-latest-commit-sha
85+
run: |
86+
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
87+
88+
- name: Define pin-system-tests branch name
89+
id: define-pin-branch
90+
run: echo "branch=ci/pin-system-tests-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
91+
92+
- name: Check if pin-system-tests branch already exists
93+
id: check-pin-branch
94+
run: |
95+
BRANCH=${{ steps.define-pin-branch.outputs.branch }}
96+
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
97+
echo "ERROR: Branch $BRANCH already exists - please delete it and re-run the workflow."
98+
exit 1
99+
else
100+
echo "Branch $BRANCH does not exist - creating it now."
101+
fi
102+
103+
- name: Update system-tests references to latest commit SHA of system-tests main
104+
run: ./tooling/update_system_test_reference.sh
105+
106+
- name: Check if changes should be committed
107+
id: check-changes
108+
run: |
109+
if [[ -z "$(git status -s)" ]]; then
110+
echo "ERROR: No changes to commit - the system-tests reference was not updated."
111+
exit 1
112+
else
113+
echo "Changes to commit:"
114+
git status -s
115+
fi
116+
117+
- name: Commit changes
118+
id: create-commit
119+
run: |
120+
git config user.name "github-actions[bot]"
121+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
122+
git commit -m "chore: Pin system-tests for release branch" .github/workflows/run-system-tests.yaml
123+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
124+
125+
- name: Push changes
126+
uses: DataDog/commit-headless@05d7b7ee023e2c7d01c47832d420c2503cd416f3 # action/v2.0.3
127+
with:
128+
token: "${{ steps.octo-sts.outputs.token }}"
129+
branch: "${{ steps.define-pin-branch.outputs.branch }}"
130+
head-sha: "${{ steps.get-latest-commit-sha.outputs.sha }}"
131+
create-branch: true
132+
command: push
133+
commits: "${{ steps.create-commit.outputs.commit }}"
134+
135+
- name: Create pull request
136+
env:
137+
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
138+
run: |
139+
gh pr create --title "Pin system tests for release branch" \
140+
--base ${{ needs.create-release-branch.outputs.release-branch-name }} \
141+
--head ${{ steps.define-pin-branch.outputs.branch }} \
142+
--label "tag: dependencies" \
143+
--label "tag: no release notes" \
144+
--body "This PR pins the system-tests reference for the release branch."

.gitlab-ci.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,12 @@ default:
146146
stage: build
147147
variables:
148148
MAVEN_OPTS: "-Xms256M -Xmx1024M"
149-
GRADLE_WORKERS: 2
150-
GRADLE_MEM: 3G
151-
KUBERNETES_CPU_REQUEST: 8
152-
KUBERNETES_MEMORY_REQUEST: 10Gi
153-
KUBERNETES_MEMORY_LIMIT: 10Gi
149+
GRADLE_WORKERS: 6
150+
GRADLE_MEMORY_MIN: 1G
151+
GRADLE_MEMORY_MAX: 4G
152+
KUBERNETES_CPU_REQUEST: 10
153+
KUBERNETES_MEMORY_REQUEST: 20Gi
154+
KUBERNETES_MEMORY_LIMIT: 20Gi
154155
CACHE_TYPE: "lib" #default
155156
FF_USE_FASTZIP: "true"
156157
CACHE_COMPRESSION_LEVEL: "slowest"
@@ -197,11 +198,11 @@ default:
197198
# replace maven central part by MAVEN_REPOSITORY_PROXY in .mvn/wrapper/maven-wrapper.properties
198199
- sed -i "s|https://repo.maven.apache.org/maven2/|$MAVEN_REPOSITORY_PROXY|g" .mvn/wrapper/maven-wrapper.properties
199200
- mkdir -p .mvn/caches
200-
- export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms$GRADLE_MEM -Xmx$GRADLE_MEM -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
201+
- export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms$GRADLE_MEMORY_MIN -Xmx$GRADLE_MEMORY_MAX -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
201202
- export GRADLE_ARGS=" --build-cache --stacktrace --no-daemon --parallel --max-workers=$GRADLE_WORKERS"
202203
- *normalize_node_index
203-
# for weird reasons, gradle will always "chmod 700" the .gradle folder
204-
# with Gitlab caching, .gradle is always owned by root and thus gradle's chmod invocation fails
204+
# for weird reasons, Gradle will always "chmod 700" the .gradle folder
205+
# with Gitlab caching, .gradle is always owned by root and thus Gradle's chmod invocation fails
205206
# This dance is a hack to have .gradle owned by the Gitlab runner user
206207
- gitlab_section_start "gradle-dance" "Fix .gradle directory permissions"
207208
- cp -r .gradle .gradle-copy
@@ -295,10 +296,6 @@ build_tests:
295296
variables:
296297
BUILD_CACHE_POLICY: push
297298
DEPENDENCY_CACHE_POLICY: pull
298-
GRADLE_MEM: 4G
299-
GRADLE_WORKERS: 3
300-
KUBERNETES_MEMORY_REQUEST: 18Gi
301-
KUBERNETES_MEMORY_LIMIT: 18Gi
302299
parallel:
303300
matrix:
304301
- GRADLE_TARGET: ":baseTest"
@@ -379,11 +376,7 @@ spotless:
379376
stage: tests
380377
needs: []
381378
variables:
382-
# TODO: Latest version of spotless is failing with OOM on CI only.
383-
# Setting 8G memory solving this issue, but we need to solve it eventually.
384-
GRADLE_MEM: 8G
385-
KUBERNETES_MEMORY_REQUEST: 18Gi
386-
KUBERNETES_MEMORY_LIMIT: 18Gi
379+
GRADLE_MEMORY_MAX: 6G
387380
script:
388381
- ./gradlew --version
389382
- ./gradlew spotlessCheck $GRADLE_ARGS
@@ -577,11 +570,6 @@ muzzle-dep-report:
577570
needs: [ build_tests ]
578571
stage: tests
579572
variables:
580-
KUBERNETES_MEMORY_REQUEST: 20Gi
581-
KUBERNETES_MEMORY_LIMIT: 20Gi
582-
KUBERNETES_CPU_REQUEST: 10
583-
GRADLE_WORKERS: 4
584-
GRADLE_MEM: 3G
585573
GRADLE_PARAMS: "-PskipFlakyTests"
586574
CONTINUE_ON_FAILURE: "false"
587575
TESTCONTAINERS_CHECKS_DISABLE: "true"
@@ -607,7 +595,7 @@ muzzle-dep-report:
607595
export PROFILER_COMMAND="-XX:StartFlightRecording=settings=profile,filename=/tmp/${CI_JOB_NAME_SLUG}.jfr,dumponexit=true";
608596
fi
609597
- *prepare_test_env
610-
- export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms$GRADLE_MEM -Xmx$GRADLE_MEM $PROFILER_COMMAND -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djava.util.prefs.userRoot=/tmp/.java/.userPrefs-${CI_JOB_ID}' -Ddatadog.forkedMaxHeapSize=1024M -Ddatadog.forkedMinHeapSize=128M"
598+
- export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms$GRADLE_MEMORY_MIN -Xmx$GRADLE_MEMORY_MAX $PROFILER_COMMAND -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djava.util.prefs.userRoot=/tmp/.java/.userPrefs-${CI_JOB_ID}' -Ddatadog.forkedMinHeapSize=128M -Ddatadog.forkedMaxHeapSize=1024M"
611599
- ./gradlew --version
612600
- ./gradlew $GRADLE_TARGET $GRADLE_PARAMS -PtestJvm=$testJvm -Pslot=$CI_NODE_INDEX/$CI_NODE_TOTAL $GRADLE_ARGS --continue || $CONTINUE_ON_FAILURE
613601
after_script:
@@ -698,7 +686,7 @@ test_inst:
698686
GRADLE_TARGET: ":instrumentationTest"
699687
CACHE_TYPE: "inst"
700688
parallel:
701-
matrix: *test_matrix_6
689+
matrix: *test_matrix_8
702690

703691
test_inst_latest:
704692
extends: .test_job_with_test_agent

AGENTS.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,20 @@ It ships ~120 integrations (~200 instrumentations) for tracing, profiling, AppSe
77

88
## Project layout
99

10+
See [ARCHITECTURE.md](ARCHITECTURE.md) for detailed module descriptions.
11+
1012
```
11-
dd-java-agent/ Main agent
12-
instrumentation/ All auto-instrumentations (one dir per framework)
13-
agent-bootstrap/ Bootstrap classloader classes
14-
agent-builder/ Agent build & bytecode weaving
15-
agent-tooling/ Shared tooling for instrumentations
16-
agent-{product}/ Product-specific modules (ci-visibility, iast, profiling, debugger, llmobs, aiguard, ...)
17-
appsec/ Application Security (WAF, threat detection)
13+
dd-java-agent/ Main agent (shadow jar, instrumentations, product modules)
1814
dd-trace-api/ Public API & configuration constants
1915
dd-trace-core/ Core tracing engine (spans, propagation, writer)
20-
dd-trace-ot/ OpenTracing compatibility layer
16+
dd-trace-ot/ Legacy OpenTracing compatibility library
2117
internal-api/ Internal shared API across modules
18+
components/ Shared low-level components (context, environment, json)
2219
products/ Sub-products (feature flagging, metrics)
2320
communication/ HTTP transport to Datadog Agent
24-
components/ Shared low-level components
2521
remote-config/ Remote configuration support
2622
telemetry/ Agent telemetry
2723
utils/ Shared utility modules (config, time, socket, test, etc.)
28-
metadata/ Supported configurations metadata & requirements
29-
benchmark/ Performance benchmarks
3024
dd-smoke-tests/ Smoke tests (real apps + agent)
3125
docs/ Developer documentation (see below)
3226
```
@@ -35,6 +29,7 @@ docs/ Developer documentation (see below)
3529

3630
| Topic | File |
3731
|---|---|
32+
| Architecture & design | [ARCHITECTURE.md](ARCHITECTURE.md) |
3833
| Building from source | [BUILDING.md](BUILDING.md) |
3934
| Contributing & PR guidelines | [CONTRIBUTING.md](CONTRIBUTING.md) |
4035
| How instrumentations work | [docs/how_instrumentations_work.md](docs/how_instrumentations_work.md) |

0 commit comments

Comments
 (0)