Class AppServerBridge

java.lang.Object
io.opentelemetry.javaagent.bootstrap.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.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    captureServletAttributes(io.opentelemetry.context.Context context)
    Test whether servlet attributes should be captured.
    static Class<?>
    Class used as key in CallDepthThreadLocalMap for counting servlet invocation depth in Servlet3Advice and Servlet2Advice.
    static Throwable
    getException(io.opentelemetry.context.Context context)
    Get exception that happened during servlet invocation.
    static void
    recordException(io.opentelemetry.context.Context context, Throwable exception)
    Record exception that happened during servlet invocation so that app server instrumentation can add it to server span.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • recordException

      public static void recordException(io.opentelemetry.context.Context context, Throwable exception)
      Record exception that happened during servlet invocation so that app server instrumentation can add it to server span.
      Parameters:
      context - server context
      exception - exception that happened during servlet invocation
    • getException

      @Nullable public static Throwable getException(io.opentelemetry.context.Context context)
      Get exception that happened during servlet invocation.
      Parameters:
      context - server context
      Returns:
      exception that happened during servlet invocation
    • captureServletAttributes

      public static boolean captureServletAttributes(io.opentelemetry.context.Context context)
      Test whether servlet attributes should be captured. This method will return true only on the first call with given context.
      Parameters:
      context - server context
      Returns:
      true when servlet attributes should be captured
    • 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