Skip to content

Commit 4b52055

Browse files
authored
Merge branch 'master' into dd/apmlp-1263-tagmap-set-coretracer
2 parents d672ed7 + 8206fbc commit 4b52055

2,592 files changed

Lines changed: 119862 additions & 60017 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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
## Claude Code workflow
44

55
- Before creating a pull request, run `/techdebt` to check for technical debt, code duplication, and unnecessary complexity in the branch changes.
6+
- After running `/migrate-groovy-to-java`, run `/review-groovy-migration` on the migrated files before opening a PR.
7+
- Always write new unit tests using JUnit 5 and Java. If the target test file is `.groovy`, run the `/migrate-groovy-to-java` skill on it first.

.claude/skills/add-apm-integrations/SKILL.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ pattern before writing new code. Use it as a template.
6363
- `testImplementation` dependencies for tests
6464
- `muzzle { pass { } }` directives (see Step 9)
6565
4. Register the new module in `settings.gradle.kts` in **alphabetical order**
66+
5. Register the integration name in `metadata/supported-configurations.json`, or
67+
`checkInstrumenterModuleConfigurations` fails. The name in `super(...)` maps to env var
68+
`DD_TRACE_<NAME>_ENABLED` (`.` and `-` become `_`, uppercased — `couchbase-3`
69+
`DD_TRACE_COUCHBASE_3_ENABLED`). Add a `"type": "boolean"` entry, in alphabetical order, with
70+
aliases `DD_TRACE_INTEGRATION_<NAME>_ENABLED` and `DD_INTEGRATION_<NAME>_ENABLED`. Set `default`
71+
to the module's real default — `"true"`, or `"false"` if it overrides `defaultEnabled()` (e.g.
72+
OpenTelemetry, Hazelcast). Declaring several names (`super("a", "b")`) means one entry each.
6673

6774
## Step 5 – Write the InstrumenterModule
6875

@@ -78,6 +85,19 @@ Conventions to enforce:
7885
- Declare `contextStore()` entries if context stores are needed (key class → value class)
7986
- Keep method matchers as narrow as possible (name, parameter types, visibility)
8087

88+
### Must NOT do in InstrumenterModule
89+
90+
- **Do not extract one-shot method return values into static constants.**
91+
Methods like `triggerClasses()`, `contextStore()`, `classLoaderMatcher()`, and `methodAdvice()`
92+
are called **once** by `AgentInstaller` / the framework wiring. Extracting their return value
93+
into a `private static final` constant provides no performance benefit and needlessly bloats
94+
the constant pool of the instrumentation class.
95+
96+
`private static final String[] TRIGGER_CLASSES = new String[]{"com.example.Foo"};`
97+
`public String[] triggerClasses() { return TRIGGER_CLASSES; }`
98+
99+
`public String[] triggerClasses() { return new String[]{"com.example.Foo"}; }`
100+
81101
## Step 6 – Write the Decorator
82102

83103
- Extend the most specific available base decorator:
@@ -180,11 +200,15 @@ Run these commands in order and fix any failures before proceeding:
180200
./gradlew :dd-java-agent:instrumentation:$framework-$version:muzzle
181201
./gradlew :dd-java-agent:instrumentation:$framework-$version:test
182202
./gradlew :dd-java-agent:instrumentation:$framework-$version:latestDepTest
203+
./gradlew checkInstrumenterModuleConfigurations
183204
./gradlew spotlessCheck
184205
```
185206

186207
**If muzzle fails:** check for missing helper class names in `helperClassNames()`.
187208

209+
**If `checkInstrumenterModuleConfigurations` fails:** an integration name from `super(...)` is missing
210+
(or mismatched) in `metadata/supported-configurations.json` — see Step 4, item 5.
211+
188212
**If tests fail:** verify span lifecycle order (start → activate → error → finish → close), helper registration,
189213
and `contextStore()` map entries match actual usage.
190214

@@ -195,11 +219,13 @@ and `contextStore()` map entries match actual usage.
195219
Output this checklist and confirm each item is satisfied:
196220

197221
- [ ] `settings.gradle.kts` entry added in alphabetical order
222+
- [ ] `metadata/supported-configurations.json` has a `DD_TRACE_<NAME>_ENABLED` entry (+ the two aliases) for every name passed to `super(...)`
198223
- [ ] `build.gradle` has `compileOnly` deps and `muzzle` directives with `assertInverse = true`
199224
- [ ] `@AutoService(InstrumenterModule.class)` annotation present on the module class
200225
- [ ] `helperClassNames()` lists ALL referenced helpers (including inner, anonymous, and enum synthetic classes)
201226
- [ ] Advice methods are `static` with `@Advice.OnMethodEnter` / `@Advice.OnMethodExit` annotations
202227
- [ ] `suppress = Throwable.class` on enter/exit (unless the hooked method is a constructor)
228+
- [ ] No static constants holding return values of one-shot instrumenter methods (`triggerClasses()`, `contextStore()`, etc.)
203229
- [ ] No logger field in the Advice class or InstrumenterModule class
204230
- [ ] No `inline=false` left in production code
205231
- [ ] No `java.util.logging.*` / `java.nio.*` / `javax.management.*` in bootstrap path

0 commit comments

Comments
 (0)