Class AppServerBridge
- java.lang.Object
-
- io.opentelemetry.instrumentation.api.servlet.AppServerBridge
-
public class AppServerBridge extends Object
Helper container for Context attributes for transferring certain information between servlet integration and app-server server handler integrations.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Class<?>getCallDepthKey()Class used as key in CallDepthThreadLocalMap for counting servlet invocation depth in Servlet3Advice and Servlet2Advice.static io.opentelemetry.context.Contextinit(io.opentelemetry.context.Context ctx)Attach AppServerBridge to context.static io.opentelemetry.context.Contextinit(io.opentelemetry.context.Context ctx, boolean shouldRecordException)Attach AppServerBridge to context.static booleanshouldRecordException(io.opentelemetry.context.Context ctx)Returns true, if servlet integration should record exception thrown during servlet invocation in server span.
-
-
-
Method Detail
-
init
public static io.opentelemetry.context.Context init(io.opentelemetry.context.Context ctx)
Attach AppServerBridge to context.- Parameters:
ctx- server context- Returns:
- new context with AppServerBridge attached.
-
init
public static io.opentelemetry.context.Context init(io.opentelemetry.context.Context ctx, boolean shouldRecordException)Attach AppServerBridge to context.- Parameters:
ctx- server contextshouldRecordException- whether servlet integration should record exception thrown during servlet invocation in server span. Usefalseon servers where exceptions thrown during servlet invocation are propagated to the method where server span is closed and can be added to server span there andtrueotherwise.- Returns:
- new context with AppServerBridge attached.
-
shouldRecordException
public static boolean shouldRecordException(io.opentelemetry.context.Context ctx)
Returns true, if servlet integration should record exception thrown during servlet invocation in server span. This method should returnfalseon servers where exceptions thrown during servlet invocation are propagated to the method where server span is closed and can be added to server span there andtrueotherwise.- Parameters:
ctx- server context- Returns:
true, if servlet integration should record exception thrown during servlet invocation in server span, orfalseotherwise.
-
getCallDepthKey
public static Class<?> getCallDepthKey()
Class used as key in CallDepthThreadLocalMap for counting servlet invocation depth in Servlet3Advice and Servlet2Advice. We can not use helper classes like Servlet3Advice and Servlet2Advice for determining call depth of server invocation because they can be injected into multiple class loaders.- Returns:
- class used as a key in CallDepthThreadLocalMap for counting servlet invocation depth
-
-