Package brave.mysql
Class TracingStatementInterceptor
- java.lang.Object
-
- brave.mysql.TracingStatementInterceptor
-
- All Implemented Interfaces:
com.mysql.jdbc.Extension,com.mysql.jdbc.StatementInterceptorV2
public class TracingStatementInterceptor extends Object implements com.mysql.jdbc.StatementInterceptorV2
A MySQL statement interceptor that will report to Zipkin how long each statement takes.To use it, append
?statementInterceptors=brave.mysql.TracingStatementInterceptorto the end of the connection url.
-
-
Constructor Summary
Constructors Constructor Description TracingStatementInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()booleanexecuteTopLevelOnly()voidinit(com.mysql.jdbc.Connection conn, Properties props)com.mysql.jdbc.ResultSetInternalMethodspostProcess(String sql, com.mysql.jdbc.Statement interceptedStatement, com.mysql.jdbc.ResultSetInternalMethods originalResultSet, com.mysql.jdbc.Connection connection, int warningCount, boolean noIndexUsed, boolean noGoodIndexUsed, SQLException statementException)com.mysql.jdbc.ResultSetInternalMethodspreProcess(String sql, com.mysql.jdbc.Statement interceptedStatement, com.mysql.jdbc.Connection connection)UsesThreadLocalSpanas there's no attribute namespace shared between callbacks, but all callbacks happen on the same thread.
-
-
-
Method Detail
-
preProcess
public com.mysql.jdbc.ResultSetInternalMethods preProcess(String sql, com.mysql.jdbc.Statement interceptedStatement, com.mysql.jdbc.Connection connection)
UsesThreadLocalSpanas there's no attribute namespace shared between callbacks, but all callbacks happen on the same thread.Uses
ThreadLocalSpan.CURRENT_TRACERand this interceptor initializes before tracing.- Specified by:
preProcessin interfacecom.mysql.jdbc.StatementInterceptorV2
-
postProcess
public com.mysql.jdbc.ResultSetInternalMethods postProcess(String sql, com.mysql.jdbc.Statement interceptedStatement, com.mysql.jdbc.ResultSetInternalMethods originalResultSet, com.mysql.jdbc.Connection connection, int warningCount, boolean noIndexUsed, boolean noGoodIndexUsed, SQLException statementException)
- Specified by:
postProcessin interfacecom.mysql.jdbc.StatementInterceptorV2
-
executeTopLevelOnly
public boolean executeTopLevelOnly()
- Specified by:
executeTopLevelOnlyin interfacecom.mysql.jdbc.StatementInterceptorV2
-
init
public void init(com.mysql.jdbc.Connection conn, Properties props)- Specified by:
initin interfacecom.mysql.jdbc.Extension- Specified by:
initin interfacecom.mysql.jdbc.StatementInterceptorV2
-
destroy
public void destroy()
- Specified by:
destroyin interfacecom.mysql.jdbc.Extension- Specified by:
destroyin interfacecom.mysql.jdbc.StatementInterceptorV2
-
-