Class TracedProxy

java.lang.Object
codes.grow.packages.skywalking.tracing.TracedProxy
All Implemented Interfaces:
InvocationHandler

public final class TracedProxy extends Object implements InvocationHandler
Proxy-based interceptor that runs methods annotated with Traced.Method (on the interface or on the implementation) in a span. Methods returning a CompletionStage end their span when the stage completes. Other methods are called directly.
  • Method Details

    • create

      public static <T> T create(Class<T> iface, T target)
      Wraps target using the helpers' default tracer.
      Type Parameters:
      T - interface type
      Parameters:
      iface - interface to proxy
      target - implementation
      Returns:
      traced proxy
    • create

      public static <T> T create(Class<T> iface, T target, io.opentelemetry.api.trace.Tracer tracer)
      Wraps target with an explicit tracer.
      Type Parameters:
      T - interface type
      Parameters:
      iface - interface to proxy
      target - implementation
      tracer - tracer (null for the helpers' default)
      Returns:
      traced proxy
      Throws:
      IllegalArgumentException - when iface is not an interface
    • invoke

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      Specified by:
      invoke in interface InvocationHandler
      Throws:
      Throwable