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 voidsetServletUpdatedServerSpanName(io.opentelemetry.context.Context ctx, boolean value)Indicate that the servlet integration has updated the name for the server span.static booleanshouldRecordException(io.opentelemetry.context.Context ctx)Returns true, if servlet integration should record exception thrown during servlet invocation in server span.static booleanshouldUpdateServerSpanName(io.opentelemetry.context.Context ctx)Returns true, if servlet integration should update server span name.
-
-
-
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.
-
shouldUpdateServerSpanName
public static boolean shouldUpdateServerSpanName(io.opentelemetry.context.Context ctx)
Returns true, if servlet integration should update server span name. After server span name has been updated withsetServletUpdatedServerSpanNamethis method will returnfalse.- Parameters:
ctx- server context- Returns:
true, if the server span name should be updated by servlet integration, orfalseotherwise.
-
setServletUpdatedServerSpanName
public static void setServletUpdatedServerSpanName(io.opentelemetry.context.Context ctx, boolean value)Indicate that the servlet integration has updated the name for the server span.- Parameters:
ctx- server context
-
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
-
-