use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class PostgreSqlUrlParserTest method postgresqlParse2.
@Test
public void postgresqlParse2() {
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:postgresql://10.98.133.22:3306/test_lucy_db");
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(dbInfo.getType(), PostgreSqlConstants.POSTGRESQL);
Assert.assertEquals(dbInfo.getHost().get(0), "10.98.133.22:3306");
Assert.assertEquals(dbInfo.getDatabaseId(), "test_lucy_db");
Assert.assertEquals(dbInfo.getUrl(), "jdbc:postgresql://10.98.133.22:3306/test_lucy_db");
logger.info(dbInfo.toString());
logger.info(dbInfo.getMultipleHost());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class PostgreSqlUrlParserTest method postgresqlParseCookierunSlave2.
@Test
public void postgresqlParseCookierunSlave2() {
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:postgresql:loadbalance://10.118.222.35:5605,10.118.222.36:5605/db_cookierun?useUnicode=true&characterEncoding=UTF-8&noAccessToProcedureBodies=true&autoDeserialize=true&elideSetAutoCommits=true&sessionVariables=time_zone='%2B09:00',tx_isolation='READ-UNCOMMITTED'");
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(dbInfo.getType(), PostgreSqlConstants.POSTGRESQL);
Assert.assertEquals(dbInfo.getHost().get(0), "10.118.222.35:5605");
Assert.assertEquals(dbInfo.getHost().get(1), "10.118.222.36:5605");
Assert.assertEquals(dbInfo.getDatabaseId(), "db_cookierun");
Assert.assertEquals(dbInfo.getUrl(), "jdbc:postgresql:loadbalance://10.118.222.35:5605,10.118.222.36:5605/db_cookierun");
logger.info(dbInfo.toString());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class JDBCUrlParserTest method oracleParser2.
@Test
public void oracleParser2() {
// jdbc:oracle:thin:@hostname:port:SID
// "jdbc:oracle:thin:MYWORKSPACE/qwerty@localhost:1521:XE";
DatabaseInfo dbInfo = jdbcUrlParser.parse("jdbc:oracle:thin:MYWORKSPACE/qwerty@localhost:1521:XE");
Assert.assertTrue(dbInfo.isParsingComplete());
Assert.assertEquals(dbInfo.getType(), OracleConstants.ORACLE);
Assert.assertEquals(dbInfo.getHost().get(0), "localhost:1521");
Assert.assertEquals(dbInfo.getDatabaseId(), "XE");
Assert.assertEquals(dbInfo.getUrl(), "jdbc:oracle:thin:MYWORKSPACE/qwerty@localhost:1521:XE");
logger.info(dbInfo.toString());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo in project pinpoint by naver.
the class PostgreSqlUrlParserTest method parseFailTest1.
@Test
public void parseFailTest1() {
DatabaseInfo dbInfo = jdbcUrlParser.parse(null);
Assert.assertFalse(dbInfo.isParsingComplete());
Assert.assertEquals(ServiceType.UNKNOWN_DB, dbInfo.getType());
}
use of com.navercorp.pinpoint.bootstrap.context.DatabaseInfo 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);
}
}
}
}
}
Aggregations