|
7 | 7 |
|
8 | 8 | import static net.bytebuddy.matcher.ElementMatchers.named; |
9 | 9 | import static net.bytebuddy.matcher.ElementMatchers.returns; |
| 10 | +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; |
10 | 11 |
|
11 | 12 | import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; |
12 | 13 | import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; |
|
16 | 17 | import net.bytebuddy.description.type.TypeDescription; |
17 | 18 | import net.bytebuddy.matcher.ElementMatcher; |
18 | 19 |
|
19 | | -/** Propagate context to connection established callback. */ |
20 | | -class ResourceManagerInstrumentation implements TypeInstrumentation { |
| 20 | +class HttpClientImplInstrumentation implements TypeInstrumentation { |
21 | 21 |
|
22 | 22 | @Override |
23 | 23 | public ElementMatcher<TypeDescription> typeMatcher() { |
24 | | - return named("io.vertx.core.internal.resource.ResourceManager"); |
| 24 | + return named("io.vertx.core.http.impl.HttpClientImpl"); |
25 | 25 | } |
26 | 26 |
|
27 | 27 | @Override |
28 | 28 | public void transform(TypeTransformer transformer) { |
29 | 29 | transformer.applyAdviceToMethod( |
30 | | - named("withResourceAsync").and(returns(named("io.vertx.core.Future"))), |
31 | | - getClass().getName() + "$WithResourceAsyncAdvice"); |
| 30 | + named("request") |
| 31 | + .and(takesArgument(0, named("io.vertx.core.http.RequestOptions"))) |
| 32 | + .and(returns(named("io.vertx.core.Future"))), |
| 33 | + getClass().getName() + "$WrapFutureAdvice"); |
32 | 34 | } |
33 | 35 |
|
34 | 36 | @SuppressWarnings("unused") |
35 | | - public static class WithResourceAsyncAdvice { |
| 37 | + public static class WrapFutureAdvice { |
36 | 38 | @AssignReturned.ToReturned |
37 | 39 | @Advice.OnMethodExit(suppress = Throwable.class, inline = false) |
38 | 40 | public static Future<?> wrapFuture(@Advice.Return Future<?> future) { |
|
0 commit comments