Skip to content

Commit 09be0f5

Browse files
authored
Merge branch 'master' into bdu/report-grpc-status-code-to-tracer-client-computed-stats
2 parents 07ec949 + 87ce78d commit 09be0f5

92 files changed

Lines changed: 703 additions & 543 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/skills/migrate-groovy-to-java/SKILL.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ Migrate test Groovy files to Java using JUnit 5
1616

1717
When converting Groovy code to Java code, make sure that:
1818
- The Java code generated is compatible with JDK 8
19-
- When translating Spock tests, favor using `@CsvSource` with `|` delimiters
20-
- When using `@MethodSource`, name the arguments method by appending `Arguments` using camelCase to the test method name (e.g. `testMethodArguments`) and return a `Stream` of arguments using `Stream.of(...)` and `arguments(...)` with static import.
19+
- When translating Spock tests, prefer `@TableTest` for data rows that are naturally tabular. See detailed guidance in the "TableTest usage" section.
20+
- `@TableTest` and `@MethodSource` may be combined on the same `@ParameterizedTest` when most cases are tabular but a few cases require programmatic setup.
21+
- In combined mode, keep table-friendly cases in `@TableTest`, and put only non-tabular/complex cases in `@MethodSource`.
22+
- If `@TableTest` is not viable for the test at all, use `@MethodSource` only.
23+
- For `@MethodSource`, name the arguments method `<testMethodName>Arguments` (camelCase, e.g. `testMethodArguments`) and return `Stream<Arguments>` using `Stream.of(...)` and `arguments(...)` with static import.
2124
- Ensure parameterized test names are human-readable (i.e. no hashcodes); instead add a description string as the first `Arguments.arguments(...)` value or index the test case
2225
- When converting tuples, create a light dedicated structure instead to keep the typing system
2326
- Instead of checking a state and throwing an exception, use JUnit asserts
@@ -27,3 +30,35 @@ When converting Groovy code to Java code, make sure that:
2730
- Do not mark local variables `final`
2831
- Ensure variables are human-readable; avoid single-letter names and pre-define variables that are referenced multiple times
2932
- When translating Spock `Mock(...)` usage, use `libs.bundles.mockito` instead of writing manual recording/stub implementations
33+
34+
TableTest usage
35+
Dependency, if missing add:
36+
- Groovy: testImplementation libs.tabletest
37+
- Kotlin: testImplementation(libs.tabletest)
38+
39+
Import: `import org.tabletest.junit.TableTest;`
40+
41+
JDK 8 rules:
42+
- No text blocks.
43+
- @TableTest must use String[] annotation array syntax:
44+
```
45+
@TableTest({
46+
"a | b",
47+
"1 | 2"
48+
})
49+
```
50+
51+
Spock `where:`@TableTest:
52+
- First row = header (column names = method parameters).
53+
- Add `scenario` column as first column (display name, not a method parameter).
54+
- Use `|` delimiter; align columns so pipes line up vertically.
55+
- Prefer single quotes for strings with special chars (e.g., `'a|b'`, `'[]'`).
56+
- Blank cell = null (object types); `''` = empty string.
57+
- Collections: `[a, b]` = List/array, `{a, b}` = Set, `[k: v]` = Map.
58+
59+
Mixed eligibility:
60+
- Prefer combining `@TableTest` + `@MethodSource` on one `@ParameterizedTest` when only some cases are complex.
61+
- Use `@MethodSource` only when tabular representation is not practical for the test.
62+
63+
Do NOT use @TableTest when:
64+
- Majority of rows require complex objects or custom converters.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: migrate-junit-source-to-tabletest
3+
description: Convert JUnit 5 @MethodSource/@CsvSource/@ValueSource parameterized tests to @TableTest (JDK8)
4+
---
5+
Goal: Migrate JUnit 5 parameterized tests using @MethodSource/@CsvSource/@ValueSource to @TableTest with minimal churn and passing tests.
6+
7+
Process (do in this order):
8+
1) Locate targets via Grep (no agent subprocess). Search for: "@ParameterizedTest", "@MethodSource", "@CsvSource", "@ValueSource".
9+
2) Read all matching files up front (parallel is OK).
10+
3) Convert eligible tests to @TableTest.
11+
4) Write each modified file once in full using Write (no incremental per-test edits).
12+
5) Run module tests once and verify "BUILD SUCCESSFUL". If failed, inspect JUnit XML report.
13+
14+
Dependency:
15+
- If missing, add:
16+
- Groovy: testImplementation libs.tabletest
17+
- Kotlin: testImplementation(libs.tabletest)
18+
19+
Import: `import org.tabletest.junit.TableTest;`
20+
21+
JDK 8 rules:
22+
- No text blocks.
23+
- @TableTest must use String[] annotation array syntax:
24+
```
25+
@TableTest({
26+
"a | b",
27+
"1 | 2"
28+
})
29+
```
30+
31+
Table formatting rules (mandatory):
32+
- Always include a header row (parameter names).
33+
- Always add a "scenario" column; using common sense for naming; scenario is NOT a method parameter.
34+
- Use '|' as delimiter.
35+
- Align columns with spaces so pipes line up vertically.
36+
- Prefer single quotes for strings requiring quotes (e.g., 'a|b', '[]', '{}', ' ').
37+
38+
Conversions:
39+
A) @CsvSource
40+
- Remove @ParameterizedTest and @CsvSource.
41+
- If delimiter is '|': rows map directly to @TableTest.
42+
- If delimiter is ',' (default): replace ',' with '|' in rows.
43+
44+
B) @ValueSource
45+
- Convert to @TableTest with header from parameter name.
46+
- Each value becomes one row.
47+
- Add "scenario" column using common sense for name.
48+
49+
C) @MethodSource (convert only if values are representable as strings)
50+
- Convert when argument values are primitives, strings, enums, booleans, nulls, and simple collection literals supported by TableTest:
51+
- Array: [a, b, ...]
52+
- List: [a, b, ...]
53+
- Set: {a, b, ...}
54+
- Map: [k: v, ...]
55+
- `@TableTest` and `@MethodSource` may be combined on the same `@ParameterizedTest` when most cases are tabular but a few cases require programmatic setup.
56+
- In combined mode, keep table-friendly cases in `@TableTest`, and put only non-tabular/complex cases in `@MethodSource`.
57+
- If `@TableTest` is not viable for the test at all, use `@MethodSource` only.
58+
- For `@MethodSource`, name the arguments method `<testMethodName>Arguments` (camelCase, e.g. `testMethodArguments`) and return `Stream<Arguments>` using `Stream.of(...)` and `arguments(...)` with static import.
59+
- Blank cell = null (non-primitive).
60+
- '' = empty string.
61+
- For String params that start with '[' or '{', quote to avoid collection parsing (prefer '[]'/'{}').
62+
63+
Scenario handling:
64+
- If MethodSource includes a leading description string OR @ParameterizedTest(name=...) uses {0}, convert that to a scenario column and remove that parameter from method signature.
65+
66+
Cleanup:
67+
- Delete now-unused @MethodSource provider methods and unused imports.
68+
69+
Mixed eligibility:
70+
- Prefer combining `@TableTest` + `@MethodSource` on one `@ParameterizedTest` when only some cases are complex.
71+
72+
Do NOT convert when:
73+
- Most rows require complex builders/mocks.
74+
75+
Test command (exact):
76+
./gradlew :path:to:module:test --rerun-tasks 2>&1 | tail -20
77+
- If BUILD FAILED: cat path/to/module/build/test-results/test/TEST-*.xml

.github/CODEOWNERS

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@
5151
**/InferredProxy*.groovy @DataDog/apm-serverless
5252

5353
# @DataDog/apm-lang-platform-java
54-
/.circleci/ @DataDog/apm-lang-platform-java
5554
/.github/ @DataDog/apm-lang-platform-java
5655
/benchmark/ @DataDog/apm-lang-platform-java
5756
/components/ @DataDog/apm-lang-platform-java
58-
/dd-java-agent/instrumentation/java-*/ @DataDog/apm-lang-platform-java
57+
/dd-java-agent/instrumentation/java/ @DataDog/apm-lang-platform-java
5958
/dd-smoke-tests/concurrent/ @DataDog/apm-lang-platform-java
6059
/dd-smoke-tests/lib-injection/ @DataDog/apm-lang-platform-java
6160
/metadata/ @DataDog/apm-lang-platform-java
@@ -80,7 +79,7 @@
8079
/dd-smoke-tests/iast-propagation/ @DataDog/asm-java
8180
/dd-smoke-tests/iast-util/ @DataDog/asm-java
8281
/dd-smoke-tests/spring-security/ @DataDog/asm-java
83-
/dd-java-agent/instrumentation/commons-fileupload/ @DataDog/asm-java
82+
/dd-java-agent/instrumentation/commons-fileupload-1.5/ @DataDog/asm-java
8483
/dd-java-agent/instrumentation/spring/spring-security/ @DataDog/asm-java
8584
/dd-trace-api/src/main/java/datadog/trace/api/aiguard/ @DataDog/asm-java
8685
/dd-trace-api/src/main/java/datadog/trace/api/EventTracker.java @DataDog/asm-java
@@ -103,12 +102,12 @@
103102
/dd-java-agent/instrumentation/cucumber-5.4/ @DataDog/ci-app-libraries
104103
/dd-java-agent/instrumentation/jacoco-0.8.9/ @DataDog/ci-app-libraries
105104
/dd-java-agent/instrumentation/junit @DataDog/ci-app-libraries
106-
/dd-java-agent/instrumentation/karate/ @DataDog/ci-app-libraries
105+
/dd-java-agent/instrumentation/karate-1.0/ @DataDog/ci-app-libraries
107106
/dd-java-agent/instrumentation/scalatest-3.0.8/ @DataDog/ci-app-libraries
108-
/dd-java-agent/instrumentation/selenium/ @DataDog/ci-app-libraries
107+
/dd-java-agent/instrumentation/selenium-3.13/ @DataDog/ci-app-libraries
109108
/dd-java-agent/instrumentation/testng/ @DataDog/ci-app-libraries
110109
/dd-java-agent/instrumentation/gradle/ @DataDog/ci-app-libraries
111-
/dd-java-agent/instrumentation/gradle-testing/ @DataDog/ci-app-libraries
110+
/dd-java-agent/instrumentation/gradle-testing-5.1/ @DataDog/ci-app-libraries
112111
/dd-java-agent/instrumentation/maven @DataDog/ci-app-libraries
113112
/dd-java-agent/instrumentation/weaver-0.9/ @DataDog/ci-app-libraries
114113
/dd-smoke-tests/gradle/ @DataDog/ci-app-libraries
@@ -130,24 +129,24 @@
130129
/dd-java-agent/instrumentation/spark/ @DataDog/data-jobs-monitoring
131130

132131
# @DataDog/data-streams-monitoring
133-
/dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/datastreams @DataDog/data-streams-monitoring
134-
/dd-trace-core/src/main/java/datadog/trace/core/datastreams @DataDog/data-streams-monitoring
135-
/dd-trace-core/src/test/groovy/datadog/trace/core/datastreams @DataDog/data-streams-monitoring
136-
/internal-api/src/main/java/datadog/trace/api/datastreams @DataDog/data-streams-monitoring
137-
/dd-smoke-tests/datastreams/ @DataDog/data-streams-monitoring
138-
/internal-api/src/test/groovy/datadog/trace/api/datastreams @DataDog/data-streams-monitoring
139-
**/datastreams/ @DataDog/data-streams-monitoring
140-
**/DataStreams* @DataDog/data-streams-monitoring
141-
**/dsmTest/** @DataDog/data-streams-monitoring
132+
/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/datastreams @DataDog/data-streams-monitoring
133+
/dd-trace-core/src/main/java/datadog/trace/core/datastreams @DataDog/data-streams-monitoring
134+
/dd-trace-core/src/test/groovy/datadog/trace/core/datastreams @DataDog/data-streams-monitoring
135+
/internal-api/src/main/java/datadog/trace/api/datastreams @DataDog/data-streams-monitoring
136+
/dd-smoke-tests/datastreams/ @DataDog/data-streams-monitoring
137+
/internal-api/src/test/groovy/datadog/trace/api/datastreams @DataDog/data-streams-monitoring
138+
**/datastreams/ @DataDog/data-streams-monitoring
139+
**/DataStreams* @DataDog/data-streams-monitoring
140+
**/dsmTest/** @DataDog/data-streams-monitoring
142141

143142
/dd-java-agent/instrumentation/armeria/armeria-grpc-0.84/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
144-
/dd-java-agent/instrumentation/avro/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
143+
/dd-java-agent/instrumentation/avro-1.11.3/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
145144
/dd-java-agent/instrumentation/aws-java/aws-java-sns-1.0/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
146145
/dd-java-agent/instrumentation/aws-java/aws-java-sns-2.0/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
147146
/dd-java-agent/instrumentation/aws-java/aws-java-sqs-1.0/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
148147
/dd-java-agent/instrumentation/aws-java/aws-java-sqs-2.0/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
149148
/dd-java-agent/instrumentation/confluent-schema-registry/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
150-
/dd-java-agent/instrumentation/google-pubsub/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
149+
/dd-java-agent/instrumentation/google-pubsub-1.116/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
151150
/dd-java-agent/instrumentation/grpc-1.5/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
152151
/dd-java-agent/instrumentation/kafka/kafka-clients-0.11/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
153152
/dd-java-agent/instrumentation/kafka/kafka-clients-3.8/ @DataDog/data-streams-monitoring @DataDog/apm-idm-java
@@ -183,7 +182,8 @@
183182
/dd-trace-core/src/test/groovy/datadog/trace/llmobs/ @DataDog/ml-observability
184183

185184
# @DataDog/database-monitoring
186-
datadog/trace/bootstrap/instrumentation/dbm @DataDog/database-monitoring @DataDog/apm-idm-java
185+
/dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/dbm/ @DataDog/database-monitoring @DataDog/apm-idm-java
186+
/dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/dbm/ @DataDog/database-monitoring @DataDog/apm-idm-java
187187

188188
# @DataDog/rum
189189
/internal-api/src/main/java/datadog/trace/api/rum/ @DataDog/rum

.github/workflows/README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,6 @@ Close them if no following update within a week.
9191

9292
_Recovery:_ Manually trigger the action again.
9393

94-
### update-docker-build-image [🔗](update-docker-build-image.yaml)
95-
96-
_Trigger:_ Quarterly released, loosely [a day after the new image tag is created](https://github.com/DataDog/dd-trace-java-docker-build/blob/master/.github/workflows/docker-tag.yml).
97-
98-
_Action:_ Update the Docker build image used in GitLab CI with the latest tag.
99-
100-
_Recovery:_ Download artifacts and upload them manually to the related _download release_.
101-
102-
_Notes:_ Manually trigger the action again given the desired image tag as input.
103-
10494
### update-download-releases [🔗](update-download-releases.yaml)
10595

10696
_Trigger:_ When a release is published.

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

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)