Skip to content

Commit cb89bb3

Browse files
committed
Merge branch 'dougqh/cache-primary-instrumentation-name' of github.com:DataDog/dd-trace-java into dougqh/cache-primary-instrumentation-name
2 parents a1cb717 + 514c144 commit cb89bb3

1,194 files changed

Lines changed: 18048 additions & 9898 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.

.claude/CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@../AGENTS.md
2+
3+
## Claude Code workflow
4+
5+
- Before creating a pull request, run `/techdebt` to check for technical debt, code duplication, and unnecessary complexity in the branch changes.
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/CODEOWNERS

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,26 @@
9898
**/*Waf*.java @DataDog/asm-java
9999
**/*Waf*.groovy @DataDog/asm-java
100100

101-
# @DataDog/ci-app-libraries-java
102-
/dd-java-agent/agent-ci-visibility/ @DataDog/ci-app-libraries-java
103-
/dd-java-agent/instrumentation/cucumber-5.4/ @DataDog/ci-app-libraries-java
104-
/dd-java-agent/instrumentation/jacoco-0.8.9/ @DataDog/ci-app-libraries-java
105-
/dd-java-agent/instrumentation/junit @DataDog/ci-app-libraries-java
106-
/dd-java-agent/instrumentation/karate/ @DataDog/ci-app-libraries-java
107-
/dd-java-agent/instrumentation/scalatest-3.0.8/ @DataDog/ci-app-libraries-java
108-
/dd-java-agent/instrumentation/selenium/ @DataDog/ci-app-libraries-java
109-
/dd-java-agent/instrumentation/testng/ @DataDog/ci-app-libraries-java
110-
/dd-java-agent/instrumentation/gradle/ @DataDog/ci-app-libraries-java
111-
/dd-java-agent/instrumentation/gradle-testing/ @DataDog/ci-app-libraries-java
112-
/dd-java-agent/instrumentation/maven @DataDog/ci-app-libraries-java
113-
/dd-java-agent/instrumentation/weaver-0.9/ @DataDog/ci-app-libraries-java
114-
/dd-smoke-tests/gradle/ @DataDog/ci-app-libraries-java
115-
/dd-smoke-tests/junit-console/ @DataDog/ci-app-libraries-java
116-
/dd-smoke-tests/maven/ @DataDog/ci-app-libraries-java
117-
/internal-api/src/main/java/datadog/trace/api/git/ @DataDog/ci-app-libraries-java
118-
**/civisibility/ @DataDog/ci-app-libraries-java
119-
**/CiVisibility*.java @DataDog/ci-app-libraries-java
120-
**/CiVisibility*.groovy @DataDog/ci-app-libraries-java
101+
# @DataDog/ci-app-libraries
102+
/dd-java-agent/agent-ci-visibility/ @DataDog/ci-app-libraries
103+
/dd-java-agent/instrumentation/cucumber-5.4/ @DataDog/ci-app-libraries
104+
/dd-java-agent/instrumentation/jacoco-0.8.9/ @DataDog/ci-app-libraries
105+
/dd-java-agent/instrumentation/junit @DataDog/ci-app-libraries
106+
/dd-java-agent/instrumentation/karate/ @DataDog/ci-app-libraries
107+
/dd-java-agent/instrumentation/scalatest-3.0.8/ @DataDog/ci-app-libraries
108+
/dd-java-agent/instrumentation/selenium/ @DataDog/ci-app-libraries
109+
/dd-java-agent/instrumentation/testng/ @DataDog/ci-app-libraries
110+
/dd-java-agent/instrumentation/gradle/ @DataDog/ci-app-libraries
111+
/dd-java-agent/instrumentation/gradle-testing/ @DataDog/ci-app-libraries
112+
/dd-java-agent/instrumentation/maven @DataDog/ci-app-libraries
113+
/dd-java-agent/instrumentation/weaver-0.9/ @DataDog/ci-app-libraries
114+
/dd-smoke-tests/gradle/ @DataDog/ci-app-libraries
115+
/dd-smoke-tests/junit-console/ @DataDog/ci-app-libraries
116+
/dd-smoke-tests/maven/ @DataDog/ci-app-libraries
117+
/internal-api/src/main/java/datadog/trace/api/git/ @DataDog/ci-app-libraries
118+
**/civisibility/ @DataDog/ci-app-libraries
119+
**/CiVisibility*.java @DataDog/ci-app-libraries
120+
**/CiVisibility*.groovy @DataDog/ci-app-libraries
121121

122122
# @DataDog/debugger-java (Live Debugger)
123123
/dd-java-agent/agent-debugger/ @DataDog/debugger-java
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
issuer: https://token.actions.githubusercontent.com
2+
3+
subject: repo:DataDog/dd-trace-java:pull_request
4+
5+
claim_pattern:
6+
event_name: pull_request
7+
job_workflow_ref: DataDog/dd-trace-java/\.github/workflows/enforce-datadog-merge-queue\.yaml@refs/pull/[0-9]+/merge
8+
9+
permissions:
10+
issues: write
11+
pull_requests: write

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,19 @@ updates:
1919
gh-actions-packages:
2020
patterns:
2121
- "*"
22+
23+
- package-ecosystem: "gradle"
24+
directory: "/"
25+
schedule:
26+
interval: "weekly"
27+
allow:
28+
- dependency-name: "gradle"
29+
ignore:
30+
- dependency-name: "gradle"
31+
update-types: ["version-update:semver-major"]
32+
labels:
33+
- "comp: tooling"
34+
- "tag: dependencies"
35+
- "tag: no release notes"
36+
commit-message:
37+
prefix: "chore(build): "

.github/pull_request_template.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66

77
# Contributor Checklist
88

9-
- Format the title [according the contribution guidelines](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md#title-format)
10-
- Assign the `type:` and (`comp:` or `inst:`) labels in addition to [any useful labels](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md#labels)
11-
- Don't use `close`, `fix` or any [linking keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) when referencing an issue.
9+
- Format the title according to [the contribution guidelines](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md#title-format)
10+
- Assign the `type:` and (`comp:` or `inst:`) labels in addition to [any other useful labels](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md#labels)
11+
- Avoid using `close`, `fix`, or [any linking keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) when referencing an issue
1212
Use `solves` instead, and assign the PR [milestone](https://github.com/DataDog/dd-trace-java/milestones) to the issue
13-
- Update the [CODEOWNERS](https://github.com/DataDog/dd-trace-java/blob/master/.github/CODEOWNERS) file on source file addition, move, or deletion
14-
- Update the [public documentation](https://docs.datadoghq.com/tracing/trace_collection/library_config/java/) in case of new configuration flag or behavior
13+
- Update the [CODEOWNERS](https://github.com/DataDog/dd-trace-java/blob/master/.github/CODEOWNERS) file on source file addition, migration, or deletion
14+
- Update [public documentation](https://docs.datadoghq.com/tracing/trace_collection/library_config/java/) with any new configuration flags or behaviors
1515

1616
Jira ticket: [PROJ-IDENT]
1717

18+
***Note:*** **Once your PR is ready to merge, add it to the merge queue by commenting `/merge`.** `/merge -c` cancels the queue request. `/merge -f --reason "reason"` skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see [this doc](https://datadoghq.atlassian.net/wiki/spaces/DEVX/pages/3121612126/MergeQueue).
19+
1820
<!--
1921
# Opening vs Drafting a PR:
2022
When opening a pull request, please open it as a draft to not auto assign reviewers before you feel the pull request is in a reviewable state.

.github/workflows/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ _Action:_ Check the pull request did not introduce unexpected label.
3636

3737
_Recovery:_ Update the pull request or add a comment to trigger the action again.
3838

39+
### enforce-datadog-merge-queue [🔗](enforce-datadog-merge-queue.yaml)
40+
41+
_Trigger:_ When creating or updating a pull request, or when a pull request is added to GitHub merge queue.
42+
43+
_Actions:_
44+
45+
* Pass the `Merge queue check` status check on pull requests so they remain in a mergeable state,
46+
* When a pull request is enqueued in GitHub merge queue, post a `/merge` comment to trigger the Datadog merge queue,
47+
* Fail the `Merge queue check` status check on merge groups to prevent GitHub from merging directly.
48+
49+
_Recovery:_ The workflow is expected to fail to block GitHub merge queue.
50+
This redirects GitHub's "Merge when ready" button to the Datadog merge queue system.
51+
3952
### create-release-branch [🔗](create-release-branch.yaml)
4053

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

.github/workflows/analyze-changes.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
${{ runner.os }}-gradle-
3131
3232
- name: Initialize CodeQL
33-
uses: github/codeql-action/init@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1
33+
uses: github/codeql-action/init@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3
3434
with:
3535
languages: 'java'
3636
build-mode: 'manual'
@@ -49,7 +49,7 @@ jobs:
4949
--build-cache --parallel --stacktrace --no-daemon --max-workers=4
5050
5151
- name: Perform CodeQL Analysis and upload results to GitHub Security tab
52-
uses: github/codeql-action/analyze@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1
52+
uses: github/codeql-action/analyze@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3
5353

5454
trivy:
5555
name: Analyze changes with Trivy
@@ -101,7 +101,7 @@ jobs:
101101
ls -laR "./workspace/.trivy"
102102
103103
- name: Run Trivy security scanner
104-
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
104+
uses: aquasecurity/trivy-action@c1824fd6edce30d7ab345a9989de00bbd46ef284 # v0.34.0
105105
with:
106106
scan-type: rootfs
107107
scan-ref: './workspace/.trivy/'
@@ -114,7 +114,7 @@ jobs:
114114
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db
115115

116116
- name: Upload Trivy scan results to GitHub Security tab
117-
uses: github/codeql-action/upload-sarif@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1
117+
uses: github/codeql-action/upload-sarif@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3
118118
if: always()
119119
with:
120120
sarif_file: 'trivy-results.sarif'

.github/workflows/check-pull-request-labels.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
'inst:',
3232
'tag:',
3333
'mergequeue-status:',
34+
'team:',
3435
'performance:', // To refactor to 'ci: ' in the future
3536
'run-tests:' // Unused since GitLab migration
3637
]
@@ -55,7 +56,7 @@ jobs:
5556
'**This PR is blocked until:**\n' +
5657
'1. The invalid labels are deleted, and\n' +
5758
'2. A maintainer deletes this comment to unblock the PR\n\n' +
58-
'**Note:** Simply removing labels from the pull request is not enough - a maintainer must remove the label and delete this comment to remove the block.\n\n' +
59+
'**Note:** Simply removing labels from the pull request is not enough - a maintainer must delete this comment then remove the label to remove the block.\n\n' +
5960
commentMarker
6061
6162
if (blockingComment) {
@@ -79,5 +80,9 @@ jobs:
7980
}
8081
if (blockingComment) {
8182
// Block the PR by failing the workflow
82-
core.setFailed(`PR blocked: Invalid labels detected: (${invalidLabels.join(', ')}). A maintainer must delete the blocking comment after fixing the labels to allow merging.`)
83+
if (hasInvalidLabels) {
84+
core.setFailed(`PR blocked: Invalid labels detected: (${invalidLabels.join(', ')}). A maintainer must delete the blocking comment after fixing the labels to allow merging.`)
85+
} else {
86+
core.setFailed(`PR blocked: A previous blocking comment still exists. A maintainer must delete it to allow merging.`)
87+
}
8388
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Enforce Datadog Merge Queue
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, enqueued]
6+
branches:
7+
- master
8+
merge_group:
9+
10+
jobs:
11+
enforce_datadog_merge_queue:
12+
name: Merge queue check
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write # required for OIDC token federation
16+
steps:
17+
- name: Block GitHub merge queue
18+
if: github.event_name == 'merge_group'
19+
run: |
20+
echo "Merge is handled by the Datadog merge queue system. Use the /merge command to enqueue your PR for merging."
21+
exit 1
22+
- name: Get OIDC token
23+
if: github.event.action == 'enqueued'
24+
uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
25+
id: octo-sts
26+
with:
27+
scope: DataDog/dd-trace-java
28+
policy: self.enforce-datadog-merge-queue.comment-pr
29+
- name: Post /merge comment
30+
if: github.event.action == 'enqueued'
31+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # 8.0.0
32+
with:
33+
github-token: ${{ steps.octo-sts.outputs.token }}
34+
script: |
35+
await github.rest.issues.createComment({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: context.payload.pull_request.number,
39+
body: '/merge'
40+
});

0 commit comments

Comments
 (0)