Class 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.Context init​(io.opentelemetry.context.Context ctx)
      Attach AppServerBridge to context.
      static io.opentelemetry.context.Context init​(io.opentelemetry.context.Context ctx, boolean shouldRecordException)
      Attach AppServerBridge to context.
      static void setServletUpdatedServerSpanName​(io.opentelemetry.context.Context ctx, boolean value)
      Indicate that the servlet integration has updated the name for the server span.
      static boolean shouldRecordException​(io.opentelemetry.context.Context ctx)
      Returns true, if servlet integration should record exception thrown during servlet invocation in server span.
      static boolean shouldUpdateServerSpanName​(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 context
        shouldRecordException - whether servlet integration should record exception thrown during servlet invocation in server span. Use false on 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 and true otherwise.
        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 with setServletUpdatedServerSpanName this method will return false.
        Parameters:
        ctx - server context
        Returns:
        true, if the server span name should be updated by servlet integration, or false otherwise.
      • 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 return false on 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 and true otherwise.
        Parameters:
        ctx - server context
        Returns:
        true, if servlet integration should record exception thrown during servlet invocation in server span, or false otherwise.
      • 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