Skip to content

Commit

Permalink
Attach response to request on Jetty
Browse files Browse the repository at this point in the history
  • Loading branch information
agoallikmaa committed May 20, 2021
1 parent ead08ad commit 622f291
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class Jetty11HandlerAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static void onEnter(
@Advice.This Object source,
@Advice.Argument(value = 2, readOnly = false) HttpServletRequest request,
@Advice.Argument(2) HttpServletRequest request,
@Advice.Argument(3) HttpServletResponse response,
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope) {

Expand All @@ -31,6 +32,8 @@ public static void onEnter(

context = tracer().startServerSpan(request);
scope = context.makeCurrent();

tracer().setAsyncListenerResponse(request, response);
}

@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class Jetty8HandlerAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static void onEnter(
@Advice.This Object source,
@Advice.Argument(value = 2, readOnly = false) HttpServletRequest request,
@Advice.Argument(2) HttpServletRequest request,
@Advice.Argument(3) HttpServletResponse response,
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope) {

Expand All @@ -31,6 +32,8 @@ public static void onEnter(

context = tracer().startServerSpan(request);
scope = context.makeCurrent();

tracer().setAsyncListenerResponse(request, response);
}

@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
Expand Down

0 comments on commit 622f291

Please sign in to comment.