Fix call depth (#4338)
This commit is contained in:
parent
8f29dfc8f9
commit
87038f2899
|
@ -36,13 +36,13 @@ public class Servlet3Advice {
|
|||
@Advice.Local("otelContext") Context context,
|
||||
@Advice.Local("otelScope") Scope scope) {
|
||||
|
||||
callDepth = CallDepth.forClass(AppServerBridge.getCallDepthKey());
|
||||
callDepth.getAndIncrement();
|
||||
|
||||
if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)) {
|
||||
return;
|
||||
}
|
||||
|
||||
callDepth = CallDepth.forClass(AppServerBridge.getCallDepthKey());
|
||||
callDepth.getAndIncrement();
|
||||
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
|
||||
Context currentContext = Java8BytecodeBridge.currentContext();
|
||||
|
|
|
@ -37,13 +37,13 @@ public class JakartaServletServiceAdvice {
|
|||
@Advice.Local("otelContext") Context context,
|
||||
@Advice.Local("otelScope") Scope scope) {
|
||||
|
||||
callDepth = CallDepth.forClass(AppServerBridge.getCallDepthKey());
|
||||
callDepth.getAndIncrement();
|
||||
|
||||
if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)) {
|
||||
return;
|
||||
}
|
||||
|
||||
callDepth = CallDepth.forClass(AppServerBridge.getCallDepthKey());
|
||||
callDepth.getAndIncrement();
|
||||
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
|
||||
Context currentContext = Java8BytecodeBridge.currentContext();
|
||||
|
@ -98,12 +98,12 @@ public class JakartaServletServiceAdvice {
|
|||
@Advice.Local("otelContext") Context context,
|
||||
@Advice.Local("otelScope") Scope scope) {
|
||||
|
||||
boolean topLevel = callDepth.decrementAndGet() == 0;
|
||||
|
||||
if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean topLevel = callDepth.decrementAndGet() == 0;
|
||||
|
||||
helper()
|
||||
.end(
|
||||
requestContext,
|
||||
|
|
Loading…
Reference in New Issue