类 Tracer

java.lang.Object
com.alibaba.csp.sentinel.Tracer

public class Tracer extends Object
This class is used to record other exceptions except block exception.
作者:
jialiang.linjl, Eric Zhao
  • 字段详细资料

  • 构造器详细资料

    • Tracer

      protected Tracer()
  • 方法详细资料

    • trace

      public static void trace(Throwable e)
      Trace provided Throwable to the resource entry in current context.
      参数:
      e - exception to record
    • trace

      @Deprecated public static void trace(Throwable e, int count)
      已过时。
      Trace provided Throwable to current entry in current context.
      参数:
      e - exception to record
      count - exception count to add
    • traceContext

      public static void traceContext(Throwable e, Context context)
      Trace provided Throwable to current entry of given entrance context.
      参数:
      e - exception to record
      context - target entrance context
      从以下版本开始:
      1.8.0
    • traceContext

      @Deprecated public static void traceContext(Throwable e, int count, Context context)
      已过时。
      Trace provided Throwable and add exception count to current entry in provided context.
      参数:
      e - exception to record
      count - exception count to add
      从以下版本开始:
      1.4.2
    • traceEntry

      public static void traceEntry(Throwable e, Entry entry)
      Trace provided Throwable to the given resource entry.
      参数:
      e - exception to record
      从以下版本开始:
      1.4.2
    • setExceptionsToTrace

      @SafeVarargs public static void setExceptionsToTrace(Class<? extends Throwable>... traceClasses)
      Set exception to trace. If not set, all Exception except for BlockException will be traced.

      Note that if both setExceptionsToIgnore(Class[]) and this method is set, the ExceptionsToIgnore will be of higher precedence.

      参数:
      traceClasses - the list of exception classes to trace.
      从以下版本开始:
      1.6.1
    • getExceptionsToTrace

      public static Class<? extends Throwable>[] getExceptionsToTrace()
      Get exception classes to trace.
      返回:
      an array of exception classes to trace.
      从以下版本开始:
      1.6.1
    • setExceptionsToIgnore

      @SafeVarargs public static void setExceptionsToIgnore(Class<? extends Throwable>... ignoreClasses)
      Set exceptions to ignore. if not set, all Exception except for BlockException will be traced.

      Note that if both setExceptionsToTrace(Class[]) and this method is set, the ExceptionsToIgnore will be of higher precedence.

      参数:
      ignoreClasses - the list of exception classes to ignore.
      从以下版本开始:
      1.6.1
    • getExceptionsToIgnore

      public static Class<? extends Throwable>[] getExceptionsToIgnore()
      Get exception classes to ignore.
      返回:
      an array of exception classes to ignore.
      从以下版本开始:
      1.6.1
    • getExceptionPredicate

      public static Predicate<? extends Throwable> getExceptionPredicate()
      Get exception predicate
      返回:
      the exception predicate.
    • setExceptionPredicate

      public static void setExceptionPredicate(Predicate<Throwable> exceptionPredicate)
      set an exception predicate which indicates the exception should be traced(return true) or ignored(return false) except for BlockException
      参数:
      exceptionPredicate - the exception predicate
    • shouldTrace

      protected static boolean shouldTrace(Throwable t)
      Check whether the throwable should be traced.
      参数:
      t - the throwable to check.
      返回:
      true if the throwable should be traced, else return false.