use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class CassandraDriverConnectInterceptor method doInAfterTrace.
@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
if (recordConnection) {
DatabaseInfo databaseInfo;
if (result instanceof DatabaseInfoAccessor) {
databaseInfo = ((DatabaseInfoAccessor) result)._$PINPOINT$_getDatabaseInfo();
} else {
databaseInfo = null;
}
if (databaseInfo == null) {
databaseInfo = UnKnownDatabaseInfo.INSTANCE;
}
// Count database connect too because it's very heavy operation
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 CassandraPreparedStatementCreateInterceptor 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.getType());
recorder.recordEndPoint(databaseInfo.getMultipleHost());
recorder.recordDestinationId(databaseInfo.getDatabaseId());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class DefaultJdbcUrlParsingServiceTest method cacheTest1.
@Test
public void cacheTest1() throws Exception {
JdbcUrlParsingService jdbcUrlParsingService = new DefaultJdbcUrlParsingService(Arrays.asList(jdbcUrlParser));
DatabaseInfo databaseInfo = jdbcUrlParsingService.getDatabaseInfo(MYSQL_JDBC_URL);
Assert.assertNull(databaseInfo);
DatabaseInfo parsingResult = jdbcUrlParsingService.parseJdbcUrl(ServiceType.TEST, MYSQL_JDBC_URL);
Assert.assertTrue(parsingResult.isParsingComplete());
DatabaseInfo cache1 = jdbcUrlParsingService.getDatabaseInfo(MYSQL_JDBC_URL);
DatabaseInfo cache2 = jdbcUrlParsingService.getDatabaseInfo(MYSQL_JDBC_URL);
Assert.assertTrue(parsingResult == cache1 && parsingResult == cache2);
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class MariaDBUrlParserTest method mariadbParse1.
@Test
public void mariadbParse1() {
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:mariadb://ip_address:3306/database_name?useUnicode=yes&characterEncoding=UTF-8");
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(dbInfo.getType(), MariaDBConstants.MARIADB);
Assert.assertEquals(dbInfo.getHost().get(0), ("ip_address:3306"));
Assert.assertEquals(dbInfo.getDatabaseId(), "database_name");
Assert.assertEquals(dbInfo.getUrl(), "jdbc:mariadb://ip_address:3306/database_name");
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class MariaDBUrlParserTest method mariadbParse3.
@Test
public void mariadbParse3() {
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:mariadb://61.74.71.31/log?useUnicode=yes&characterEncoding=UTF-8");
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(dbInfo.getType(), MariaDBConstants.MARIADB);
Assert.assertEquals(dbInfo.getHost().get(0), "61.74.71.31");
Assert.assertEquals(dbInfo.getDatabaseId(), "log");
Assert.assertEquals(dbInfo.getUrl(), "jdbc:mariadb://61.74.71.31/log");
logger.info(dbInfo.toString());
}
Aggregations