Package brave.mysql8

Class TracingExceptionInterceptor

  • All Implemented Interfaces:
    com.mysql.cj.exceptions.ExceptionInterceptor

    public class TracingExceptionInterceptor
    extends Object
    implements com.mysql.cj.exceptions.ExceptionInterceptor
    A MySQL exception interceptor that will annotate spans with SQL error codes.

    To use it, both TracingQueryInterceptor and TracingExceptionInterceptor must be added by appending ?queryInterceptors=brave.mysql8.TracingQueryInterceptor&exceptionInterceptors=brave.mysql8.TracingExceptionInterceptor.

    • Constructor Detail

      • TracingExceptionInterceptor

        public TracingExceptionInterceptor()
    • Method Detail

      • init

        public com.mysql.cj.exceptions.ExceptionInterceptor init​(Properties properties,
                                                                 com.mysql.cj.log.Log log)
        Specified by:
        init in interface com.mysql.cj.exceptions.ExceptionInterceptor
      • destroy

        public void destroy()
        Specified by:
        destroy in interface com.mysql.cj.exceptions.ExceptionInterceptor
      • interceptException

        public Exception interceptException​(Exception e)
        Uses ThreadLocalSpan as there's no attribute namespace shared between callbacks, but all callbacks happen on the same thread. The span will already have been created in TracingQueryInterceptor.

        Uses ThreadLocalSpan.CURRENT_TRACER and this interceptor initializes before tracing.

        Specified by:
        interceptException in interface com.mysql.cj.exceptions.ExceptionInterceptor