use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class PreparedStatementExecuteQueryInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
SpanEventRecorder recorder = trace.traceBlockBegin();
try {
DatabaseInfo databaseInfo = (target instanceof DatabaseInfoAccessor) ? ((DatabaseInfoAccessor) target)._$PINPOINT$_getDatabaseInfo() : null;
if (databaseInfo == null) {
databaseInfo = UnKnownDatabaseInfo.INSTANCE;
}
recorder.recordServiceType(databaseInfo.getExecuteQueryType());
recorder.recordEndPoint(databaseInfo.getMultipleHost());
recorder.recordDestinationId(databaseInfo.getDatabaseId());
ParsingResult parsingResult = null;
if (target instanceof ParsingResultAccessor) {
parsingResult = ((ParsingResultAccessor) target)._$PINPOINT$_getParsingResult();
}
Map<Integer, String> bindValue = null;
if (target instanceof BindValueAccessor) {
bindValue = ((BindValueAccessor) target)._$PINPOINT$_getBindValue();
}
if (bindValue != null) {
String bindString = toBindVariable(bindValue);
recorder.recordSqlParsingResult(parsingResult, bindString);
} else {
recorder.recordSqlParsingResult(parsingResult);
}
recorder.recordApi(descriptor);
// trace.recordApi(apiId);
// Need to change where to invoke clean().
// There is cleanParameters method but it's not necessary to intercept that method.
// iBatis intentionally does not invoke it in most cases.
clean(target);
} catch (Exception e) {
if (logger.isWarnEnabled()) {
logger.warn(e.getMessage(), e);
}
}
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class StatementExecuteUpdateInterceptor method doInBeforeTrace.
@Override
public void doInBeforeTrace(SpanEventRecorder recorder, Object target, Object[] args) {
DatabaseInfo databaseInfo = (target instanceof DatabaseInfoAccessor) ? ((DatabaseInfoAccessor) target)._$PINPOINT$_getDatabaseInfo() : null;
if (databaseInfo == null) {
databaseInfo = UnKnownDatabaseInfo.INSTANCE;
}
recorder.recordServiceType(databaseInfo.getExecuteQueryType());
recorder.recordEndPoint(databaseInfo.getMultipleHost());
recorder.recordDestinationId(databaseInfo.getDatabaseId());
recorder.recordApi(methodDescriptor);
if (args != null && args.length > 0) {
Object arg = args[0];
if (arg instanceof String) {
recorder.recordSqlInfo((String) arg);
}
}
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class TransactionCommitInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
DatabaseInfo databaseInfo = (target instanceof DatabaseInfoAccessor) ? ((DatabaseInfoAccessor) target)._$PINPOINT$_getDatabaseInfo() : null;
if (databaseInfo == null) {
databaseInfo = UnKnownDatabaseInfo.INSTANCE;
}
recorder.recordServiceType(databaseInfo.getType());
recorder.recordEndPoint(databaseInfo.getMultipleHost());
recorder.recordDestinationId(databaseInfo.getDatabaseId());
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class TransactionSetAutoCommitInterceptor method doInAfterTrace.
@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
DatabaseInfo databaseInfo = (target instanceof DatabaseInfoAccessor) ? ((DatabaseInfoAccessor) target)._$PINPOINT$_getDatabaseInfo() : null;
if (databaseInfo == null) {
databaseInfo = UnKnownDatabaseInfo.INSTANCE;
}
recorder.recordServiceType(databaseInfo.getType());
recorder.recordEndPoint(databaseInfo.getMultipleHost());
recorder.recordDestinationId(databaseInfo.getDatabaseId());
recorder.recordApi(methodDescriptor, args);
recorder.recordException(throwable);
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class JdbcUrlParser method parse.
//http://www.petefreitag.com/articles/jdbc_urls/
public DatabaseInfo parse(String url) {
if (url == null) {
return UnKnownDatabaseInfo.INSTANCE;
}
final DatabaseInfo hit = cache.get(url);
if (hit != null) {
logger.debug("database url cache hit:{} {}", url, hit);
return hit;
}
DatabaseInfo databaseInfo = null;
try {
databaseInfo = doParse(url);
} catch (Exception e) {
logger.error("connectionString parse fail. url:{} ", url);
databaseInfo = UnKnownDatabaseInfo.INSTANCE;
}
final DatabaseInfo old = cache.putIfAbsent(url, databaseInfo);
if (old != null) {
return old;
}
return databaseInfo;
}
Aggregations