Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indy advice docs & migration procedure #11546

Merged
merged 48 commits into from
Aug 28, 2024
Merged
Changes from 3 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4dd52a9
hibernate + minimal doc
SylvainJuge Jun 10, 2024
7766f35
awk sdk
SylvainJuge Jun 10, 2024
07a5f90
spotless
SylvainJuge Jun 10, 2024
c1ba53b
remove leftover
SylvainJuge Jun 10, 2024
b7b3676
add elasticsearch
SylvainJuge Jun 10, 2024
41abb88
add netty
SylvainJuge Jun 10, 2024
b03321b
inline aws
SylvainJuge Jun 11, 2024
8827c1e
hibernate-3
SylvainJuge Jun 11, 2024
9efaf2d
hibernate-4
SylvainJuge Jun 11, 2024
bcaeaf4
document advice local variables
SylvainJuge Jun 11, 2024
8dbccdc
document indy modules
SylvainJuge Jun 11, 2024
c012aac
hibernate-6
SylvainJuge Jun 11, 2024
27e36cd
hibernate-procedure-call
SylvainJuge Jun 11, 2024
98f74d0
aws remove explicit inline
SylvainJuge Jun 11, 2024
957a7b8
reword documentation with transition proposal
SylvainJuge Jun 11, 2024
25660bd
revert indy module for hibernate-*
SylvainJuge Jun 11, 2024
ac0e649
move aws-sdk to #11552
SylvainJuge Jun 11, 2024
f48e203
move hibernate to #11553
SylvainJuge Jun 11, 2024
9aaf628
move elasticsearch to #11554
SylvainJuge Jun 11, 2024
cd85238
document params, return value and fields
SylvainJuge Jun 11, 2024
ae87603
move netty-* to #11559
SylvainJuge Jun 12, 2024
7fc8e15
revert changes for akka
SylvainJuge Jun 12, 2024
c477985
add indy/inline clarification
SylvainJuge Jun 12, 2024
fc0be19
post-review changes
SylvainJuge Jun 26, 2024
cfefa13
clarify with 3 buckets
SylvainJuge Jun 26, 2024
530609c
document for indy native + comment for indy compat
SylvainJuge Jun 26, 2024
ce07791
add clarification on typing
SylvainJuge Jun 26, 2024
2d73c74
loading classes in app CL
SylvainJuge Jun 26, 2024
9c9a1a2
post-review fix inconsistency
SylvainJuge Jun 27, 2024
f976a12
remove redundant comment on indy inlined
SylvainJuge Jul 1, 2024
bf29897
Update docs/contributing/writing-instrumentation-module.md
SylvainJuge Jul 1, 2024
8287992
Apply suggestions from code review
SylvainJuge Jul 1, 2024
0a6bbc1
Apply suggestions from code review
SylvainJuge Jul 1, 2024
0d089c2
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Jul 9, 2024
547d422
docuemnt advice method signature limitations
SylvainJuge Jul 9, 2024
e84d908
Merge branch 'indy-dispatch' of github.com:SylvainJuge/opentelemetry-…
SylvainJuge Jul 9, 2024
e1bdfaf
Apply suggestions from code review
SylvainJuge Jul 10, 2024
ac90f56
bytebuddy -> ByteBuddy
SylvainJuge Jul 18, 2024
f254887
remove advice method signature limitation
SylvainJuge Aug 12, 2024
fe702b7
remove limitation on advice return type
SylvainJuge Aug 12, 2024
5625aa1
Apply suggestions from code review
SylvainJuge Aug 14, 2024
a1d30a9
Apply suggestions from code review
SylvainJuge Aug 14, 2024
89624af
remove dynamic assignment requirement
SylvainJuge Aug 14, 2024
87d535c
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Aug 14, 2024
14f3423
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-i…
SylvainJuge Aug 19, 2024
db007a4
capitalize for consistency
SylvainJuge Aug 19, 2024
da744fa
capitalize headers
SylvainJuge Aug 20, 2024
3405ae1
remove paragraph
SylvainJuge Aug 22, 2024
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
34 changes: 34 additions & 0 deletions docs/contributing/writing-instrumentation-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,40 @@ module classloader.

This allows for example to access package-private methods that would not be accessible otherwise.

### advice method signatures

With inlined advices, the advice method signature does not have any limitations. It enables to refer
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
to types in the OpenTelemetry API, SDK or instrumentation helper classes directly because those
are injected in the target classloader or the bootstrap classloader for visibility.

With indy advices however, the advice method signature can't introduce types that are not already
visible from the instrumented method.
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved
In practice, two sets of types can be used in the advice method signature:
- types from the JDK in the bootstrap classloader like `Object`
- types already visible from the instrumented code

For example, when trying to instrument a method that has `HttpServletRequest` as argument:
- the `HttpServletRequest` type can be used as it's part of the instrumented code
- the `HttpServletRequestScope` is part of instrumentation and has to be of type `Object` from enter return value and exit argument.
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved

```java
@Advice.OnMethodEnter(suppress = Throwable.class, inlined = false)
public static Object onEnter(@Advice.Argument(1) HttpServletRequest request) {
// custom type from the instrumentation module, has to be returned as Object
return new HttpServletRequestScope(request);
}

@Advice.OnMethodExit(suppress = Throwable.class, onThrowable = Throwable.class, inlined = false)
public static void onExit(@Advice.Argument(1) Object request,
@Advice.Enter Object enterScope) {
// enter scope provided as Object so we have to check type and cast
if (!(enterScope instanceof HttpServletRequestScope)) {
return;
}
HttpServletRequestScope requestScope = (HttpServletRequestScope)enterScope;
}
```

### advice local variables
SylvainJuge marked this conversation as resolved.
Show resolved Hide resolved

With inlined advices, declaring an advice method argument with `@Advice.Local` allows defining
Expand Down
Loading