Skip to content

Commit 822abc7

Browse files
authored
Polished contributing document (#10693)
1 parent e298000 commit 822abc7

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

docs/contributing/writing-instrumentation-module.md

+6-10
Original file line numberDiff line numberDiff line change
@@ -344,23 +344,19 @@ compile time for it to work.
344344
Use of `VirtualField` requires the `muzzle-generation` gradle plugin. Failing to use the plugin will result in
345345
ClassNotFoundException when trying to access the field.
346346

347-
### Why we don't use ByteBuddy @Advice.Origin Method
347+
### Avoid using @Advice.Origin Method
348348

349-
Instead of
349+
You shouldn't use ByteBuddy's @Advice.Origin Method method, as it
350+
inserts a call to `Class.getMethod(...)` in a transformed method.
350351

351-
```
352-
@Advice.Origin Method method
353-
```
352+
Instead, get the declaring class and method name, as loading
353+
constants from a constant pool is a much simpler operation.
354354

355-
we prefer to use
355+
For example:
356356

357357
```
358358
@Advice.Origin("#t") Class<?> declaringClass,
359359
@Advice.Origin("#m") String methodName
360360
```
361361

362-
because the former inserts a call to `Class.getMethod(...)` in transformed method. In contrast,
363-
getting the declaring class and method name is just loading constants from constant pool, which is
364-
a much simpler operation.
365-
366362
[suppress]: https://opentelemetry.io/docs/instrumentation/java/automatic/agent-config/#suppressing-specific-auto-instrumentation

0 commit comments

Comments
 (0)