Skip to content

Commit 0cda82f

Browse files
committed
Migrating HttpServerConnectionInstrumentation
1 parent 7472165 commit 0cda82f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/HttpServerConnectionInstrumentation.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,20 @@ public void transform(TypeTransformer transformer) {
4646
public static class ResponseAdvice {
4747

4848
@Advice.OnMethodEnter(suppress = Throwable.class)
49-
public static void onEnter(
50-
@Advice.Argument(0) HttpServerExchange exchange,
51-
@Advice.Local("otelCallDepth") CallDepth callDepth) {
52-
callDepth = CallDepth.forClass(ServerConnection.class);
49+
public static CallDepth onEnter(@Advice.Argument(0) HttpServerExchange exchange) {
50+
CallDepth callDepth = CallDepth.forClass(ServerConnection.class);
5351
if (callDepth.getAndIncrement() > 0) {
54-
return;
52+
return callDepth;
5553
}
5654

5755
Context context = helper().getServerContext(exchange);
5856
HttpServerResponseCustomizerHolder.getCustomizer()
5957
.customize(context, exchange, UndertowHttpResponseMutator.INSTANCE);
58+
return callDepth;
6059
}
6160

6261
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
63-
public static void onExit(@Advice.Local("otelCallDepth") CallDepth callDepth) {
62+
public static void onExit(@Advice.Enter CallDepth callDepth) {
6463
callDepth.decrementAndGet();
6564
}
6665
}

0 commit comments

Comments
 (0)