Java Code Examples for com.p6spy.engine.common.StatementInformation#getSql()
The following examples show how to use
com.p6spy.engine.common.StatementInformation#getSql() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TracingJdbcEventListener.java From brave with Apache License 2.0 | 5 votes |
/** * Uses {@link ThreadLocalSpan} as there's no attribute namespace shared between callbacks, but * all callbacks happen on the same thread. * * <p>Uses {@link ThreadLocalSpan#CURRENT_TRACER} and this interceptor initializes before * tracing. */ @Override public void onBeforeAnyExecute(StatementInformation info) { String sql = includeParameterValues ? info.getSqlWithValues() : info.getSql(); if (!isLoggable(sql)) return; // Gets the next span (and places it in scope) so code between here and postProcess can read it Span span = ThreadLocalSpan.CURRENT_TRACER.next(); if (span == null || span.isNoop()) return; int spaceIndex = sql.indexOf(' '); // Allow span names of single-word statements like COMMIT span.kind(CLIENT).name(spaceIndex == -1 ? sql : sql.substring(0, spaceIndex)); span.tag("sql.query", sql); parseServerIpAndPort(info.getConnectionInformation().getConnection(), span); span.start(); }
Example 2
Source File: TracingJdbcEventListener.java From spring-boot-data-source-decorator with Apache License 2.0 | 4 votes |
private String getSql(StatementInformation statementInformation) { return includeParameterValues && StringUtils.hasText(statementInformation.getSqlWithValues()) ? statementInformation.getSqlWithValues() : statementInformation.getSql(); }