Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .claude/skills/add-apm-integrations/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ Conventions to enforce:
- Declare `contextStore()` entries if context stores are needed (key class → value class)
- Keep method matchers as narrow as possible (name, parameter types, visibility)

### Must NOT do in InstrumenterModule

- **Do not extract one-shot method return values into static constants.**
Methods like `triggerClasses()`, `contextStore()`, `classLoaderMatcher()`, and `methodAdvice()`
are called **once** by `AgentInstaller` / the framework wiring. Extracting their return value
into a `private static final` constant provides no performance benefit and needlessly bloats
the constant pool of the instrumentation class.

❌ `private static final String[] TRIGGER_CLASSES = new String[]{"com.example.Foo"};`
`public String[] triggerClasses() { return TRIGGER_CLASSES; }`

✅ `public String[] triggerClasses() { return new String[]{"com.example.Foo"}; }`

## Step 6 – Write the Decorator

- Extend the most specific available base decorator:
Expand Down Expand Up @@ -200,6 +213,7 @@ Output this checklist and confirm each item is satisfied:
- [ ] `helperClassNames()` lists ALL referenced helpers (including inner, anonymous, and enum synthetic classes)
- [ ] Advice methods are `static` with `@Advice.OnMethodEnter` / `@Advice.OnMethodExit` annotations
- [ ] `suppress = Throwable.class` on enter/exit (unless the hooked method is a constructor)
- [ ] No static constants holding return values of one-shot instrumenter methods (`triggerClasses()`, `contextStore()`, etc.)
- [ ] No logger field in the Advice class or InstrumenterModule class
- [ ] No `inline=false` left in production code
- [ ] No `java.util.logging.*` / `java.nio.*` / `javax.management.*` in bootstrap path
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ docs/ Developer documentation (see below)
- **Test frameworks**: Always use JUnit 5. **Do not write new Groovy / Spock tests** and migrate the existing one to JUnit 5 if it is written in Groovy.
- **Forked tests**: Use `ForkedTest` suffix when tests need a separate JVM
- **Flaky tests**: Annotate with `@Flaky` — they are skipped in CI by default
- **Instrumentation one-shot methods**: Never extract the return values of `triggerClasses()`, `contextStore()`, `classLoaderMatcher()`, or `methodAdvice()` into static constants. These are called once by the framework — extracting to a constant adds constant-pool bloat with no benefit.

## PR conventions

Expand Down
Loading