use of com.navercorp.pinpoint.bootstrap.plugin.jdbc.ParsingResultAccessor in project pinpoint by naver.
the class PreparedStatementCreateInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
if (result instanceof ParsingResultAccessor) {
ParsingResult parsingResult = ((ParsingResultAccessor) result)._$PINPOINT$_getParsingResult();
recorder.recordSqlParsingResult(parsingResult);
}
recorder.recordException(throwable);
recorder.recordApi(methodDescriptor);
}
use of com.navercorp.pinpoint.bootstrap.plugin.jdbc.ParsingResultAccessor in project pinpoint by naver.
the class PreparedStatementCreateInterceptor method prepareAfterTrace.
@Override
protected void prepareAfterTrace(Object target, Object[] args, Object result, Throwable throwable) {
final boolean success = InterceptorUtils.isSuccess(throwable);
if (success) {
if (target instanceof DatabaseInfoAccessor) {
// set databaseInfo to PreparedStatement only when preparedStatement is generated successfully.
DatabaseInfo databaseInfo = ((DatabaseInfoAccessor) target)._$PINPOINT$_getDatabaseInfo();
if (databaseInfo != null) {
if (result instanceof DatabaseInfoAccessor) {
((DatabaseInfoAccessor) result)._$PINPOINT$_setDatabaseInfo(databaseInfo);
}
}
}
if (result instanceof ParsingResultAccessor) {
// 1. Don't check traceContext. preparedStatement can be created in other thread.
// 2. While sampling is active, the thread which creates preparedStatement could not be a sampling target. So record sql anyway.
String sql = (String) args[0];
ParsingResult parsingResult = traceContext.parseSql(sql);
if (parsingResult != null) {
((ParsingResultAccessor) result)._$PINPOINT$_setParsingResult(parsingResult);
} else {
if (logger.isErrorEnabled()) {
logger.error("sqlParsing fail. parsingResult is null sql:{}", sql);
}
}
}
}
}
use of com.navercorp.pinpoint.bootstrap.plugin.jdbc.ParsingResultAccessor in project pinpoint by naver.
the class PostgreSqlPreparedStatementCreateInterceptor1 method prepareAfterTrace.
@Override
protected void prepareAfterTrace(Object target, Object[] args, Object result, Throwable throwable) {
final boolean success = InterceptorUtils.isSuccess(throwable);
if (success) {
if (target instanceof DatabaseInfoAccessor) {
// set databaseInfo to PreparedStatement only when preparedStatement is generated successfully.
final DatabaseInfo databaseInfo = ((DatabaseInfoAccessor) target)._$PINPOINT$_getDatabaseInfo();
if (databaseInfo != null) {
if (result instanceof DatabaseInfoAccessor) {
((DatabaseInfoAccessor) result)._$PINPOINT$_setDatabaseInfo(databaseInfo);
}
}
}
if (result instanceof ParsingResultAccessor) {
// 1. Don't check traceContext. preparedStatement can be created in other thread.
// 2. While sampling is active, the thread which creates preparedStatement could not be a sampling target. So record sql anyway.
String sql = (String) args[0];
final ParsingResult parsingResult = traceContext.parseSql(sql);
if (parsingResult != null) {
((ParsingResultAccessor) result)._$PINPOINT$_setParsingResult(parsingResult);
} else {
if (logger.isErrorEnabled()) {
logger.error("sqlParsing fail. parsingResult is null sql:{}", sql);
}
}
}
}
}
use of com.navercorp.pinpoint.bootstrap.plugin.jdbc.ParsingResultAccessor in project pinpoint by naver.
the class CassandraPreparedStatementCreateInterceptor method prepareAfterTrace.
@Override
protected void prepareAfterTrace(Object target, Object[] args, Object result, Throwable throwable) {
final boolean success = InterceptorUtils.isSuccess(throwable);
if (success) {
if (target instanceof DatabaseInfoAccessor) {
// set databaseInfo to PreparedStatement only when
// preparedStatement is generated successfully.
DatabaseInfo databaseInfo = ((DatabaseInfoAccessor) target)._$PINPOINT$_getDatabaseInfo();
if (databaseInfo != null) {
if (result instanceof DatabaseInfoAccessor) {
((DatabaseInfoAccessor) result)._$PINPOINT$_setDatabaseInfo(databaseInfo);
}
}
}
if (result instanceof ParsingResultAccessor) {
String sql;
if (args[0] instanceof RegularStatement) {
sql = ((RegularStatement) args[0]).getQueryString();
} else {
// we have string
sql = (String) args[0];
}
ParsingResult parsingResult = traceContext.parseSql(sql);
if (parsingResult != null) {
((ParsingResultAccessor) result)._$PINPOINT$_setParsingResult(parsingResult);
} else {
if (logger.isErrorEnabled()) {
logger.error("sqlParsing fail. parsingResult is null sql:{}", sql);
}
}
}
}
}
use of com.navercorp.pinpoint.bootstrap.plugin.jdbc.ParsingResultAccessor in project pinpoint by naver.
the class CassandraPreparedStatementCreateInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
if (result instanceof ParsingResultAccessor) {
ParsingResult parsingResult = ((ParsingResultAccessor) result)._$PINPOINT$_getParsingResult();
recorder.recordSqlParsingResult(parsingResult);
}
recorder.recordException(throwable);
recorder.recordApi(methodDescriptor);
}
Aggregations